nolo-cli 0.211.0 → 0.212.0-alpha.1

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 (158) hide show
  1. package/{_executeModel-VVQEOY3D.js → _executeModel-KE6MBNUJ.js} +51 -48
  2. package/{action-U235TV4P.js → action-DF5UYSJF.js} +4 -4
  3. package/{addContentAction-7C76J7ST.js → addContentAction-N2YC5IL3.js} +8 -8
  4. package/{addDialogAgentAction-KTYANUEC.js → addDialogAgentAction-3NKVQCEC.js} +15 -12
  5. package/{agentDeleteCommand-WHRU6VDJ.js → agentDeleteCommand-NWK7VU4N.js} +71 -67
  6. package/{agentEmailCommands-ALLHXPW3.js → agentEmailCommands-UZ4DHEX2.js} +77 -72
  7. package/{agentListCommands-POKMEKMS.js → agentListCommands-HE7L2A6L.js} +190 -77
  8. package/{agentMachineCommands-WJLZLBPI.js → agentMachineCommands-6TE4MBMP.js} +30 -29
  9. package/{agentProviderCommands-MN3ABDME.js → agentProviderCommands-Q5O33MED.js} +33 -4
  10. package/{agentRecordCommands-OULZW3KM.js → agentRecordCommands-L3QQ7HZ4.js} +66 -61
  11. package/{agentRunCommand-ZNG4LGNQ.js → agentRunCommand-2IFGQHCO.js} +68 -64
  12. package/{agentRunControl-AF7BMR22.js → agentRunControl-OI3LOENH.js} +7 -6
  13. package/{agentRuntimeLocal-YMUHFV5M.js → agentRuntimeLocal-HL526DNQ.js} +28 -25
  14. package/{agentSlice-WNGUIMQZ.js → agentSlice-TMYP2UEA.js} +12 -12
  15. package/{appDeleteCommands-6MXPLAVF.js → appDeleteCommands-ZERW4AXY.js} +30 -29
  16. package/{appDeployCommands-ERRSVASW.js → appDeployCommands-DUWSMYHL.js} +30 -29
  17. package/{appDeployStatusCommands-ULICISLI.js → appDeployStatusCommands-N2KIE4BF.js} +30 -29
  18. package/{appGetCommands-WYYYWROF.js → appGetCommands-YVR4NPVY.js} +30 -29
  19. package/{appListCommands-DFCUCRCV.js → appListCommands-JS6HOHZS.js} +30 -29
  20. package/{authCommand-ZJMWXFMA.js → authCommand-FE2C3ZUM.js} +14 -14
  21. package/{authCommands-WK6E42L2.js → authCommands-HV3EAU3V.js} +2 -2
  22. package/{builtinSkillRegistry-HH75G5J3.js → builtinSkillRegistry-3YOIGEF6.js} +5 -4
  23. package/{chunk-JKW6LERJ.js → chunk-22CIEBYO.js} +14 -14
  24. package/{chunk-6HVBI6TI.js → chunk-25JZEIXN.js} +1 -218
  25. package/{chunk-TRZP7JZ7.js → chunk-2QHFH3DR.js} +1 -0
  26. package/{chunk-4LEGTOSR.js → chunk-3AKFVZ2I.js} +1 -1
  27. package/{chunk-XE4Q46FF.js → chunk-3CGG2PAL.js} +1 -1
  28. package/{chunk-25M2K6OA.js → chunk-3FOQHGHN.js} +3 -3
  29. package/{chunk-BSISWVB4.js → chunk-4I7ERB7F.js} +1 -1
  30. package/{chunk-TCTSYFDM.js → chunk-4KH4J3G5.js} +19 -6
  31. package/{chunk-NEZGPBL7.js → chunk-5AQR3DGV.js} +2 -2
  32. package/{chunk-YLTLB5A7.js → chunk-5RYBGBQH.js} +7 -6
  33. package/{chunk-RIALQUSF.js → chunk-6NSSLV67.js} +5 -5
  34. package/{chunk-RXCCWVA2.js → chunk-6OQUPIQF.js} +3 -3
  35. package/chunk-6VLJ6YA7.js +11751 -0
  36. package/{chunk-27E2CBBY.js → chunk-7OCO4TDT.js} +1 -1
  37. package/chunk-7RFNTILS.js +2213 -0
  38. package/{chunk-4WCEC56C.js → chunk-AVTVGMDY.js} +1 -1
  39. package/{chunk-3J3U3KXB.js → chunk-B7NJ3T4A.js} +4 -4
  40. package/{chunk-UMEGDH6A.js → chunk-BFM34N54.js} +7 -7
  41. package/chunk-CJEIOP3E.js +0 -0
  42. package/{chunk-YXOBCDNW.js → chunk-CJRONOYL.js} +5 -5
  43. package/{chunk-LT3EAHJY.js → chunk-CQ46IRNN.js} +38 -36
  44. package/{chunk-NTSRCTUX.js → chunk-CTPXME7U.js} +2 -2
  45. package/{chunk-M4NTDZG3.js → chunk-D5RCRX4A.js} +134 -141
  46. package/{chunk-25OB36GU.js → chunk-DM6UMOEL.js} +4 -4
  47. package/{chunk-TPCDYNJK.js → chunk-EYUBHHFB.js} +1 -1
  48. package/{chunk-Y6M7KJOA.js → chunk-EZFQ6XRV.js} +2 -2
  49. package/{chunk-ZOO3WJIE.js → chunk-FHU44LN3.js} +711 -40
  50. package/chunk-FY7F4Q6X.js +127 -0
  51. package/chunk-G7MLNNEX.js +84 -0
  52. package/{chunk-RYWO5AKN.js → chunk-GNDJKC4B.js} +10 -10
  53. package/{chunk-V3M6IXQI.js → chunk-GPO7FCEZ.js} +187 -36
  54. package/{chunk-RQ22OZD7.js → chunk-H2TJUNCH.js} +1 -1
  55. package/{chunk-C2XZM3K4.js → chunk-HIRC32DV.js} +5 -24
  56. package/{chunk-QQM464AL.js → chunk-HPFCI4SK.js} +3 -3
  57. package/chunk-HRMJUN5J.js +26 -0
  58. package/{chunk-HD3WR3TD.js → chunk-IAPCBNEE.js} +1 -1
  59. package/{chunk-XDMGY5IU.js → chunk-IF45XG7K.js} +220 -9
  60. package/{chunk-NLT32XBZ.js → chunk-IIQ6JGRI.js} +2 -2
  61. package/{chunk-OP7PTBAJ.js → chunk-IJXYFTV7.js} +8 -8
  62. package/{chunk-IIHY4ZAI.js → chunk-INSBKSBB.js} +8 -4
  63. package/{chunk-PAFTGNWA.js → chunk-JIT6FSXJ.js} +1 -1
  64. package/{chunk-WTKYP6QO.js → chunk-JTDORD5P.js} +5 -5
  65. package/{chunk-ECX3NKRD.js → chunk-JY5NGFFH.js} +11 -0
  66. package/chunk-KC4XDTT3.js +227 -0
  67. package/{chunk-PLYWH7XM.js → chunk-KIM6CLW5.js} +7 -7
  68. package/{chunk-SCYQJPGA.js → chunk-M6RL5JCD.js} +147 -20
  69. package/chunk-MMA3LZ3W.js +105 -0
  70. package/{chunk-I5PBXF7O.js → chunk-MMNYUVLW.js} +1 -1
  71. package/{chunk-NHQKWPLP.js → chunk-NJR3WKVP.js} +24 -22
  72. package/{chunk-W5VC7F7V.js → chunk-NOMIGOST.js} +59 -60
  73. package/{chunk-WI6OGHXJ.js → chunk-NRFKLKRU.js} +5 -5
  74. package/{chunk-NXCGNS4N.js → chunk-OHNELDTO.js} +1 -1
  75. package/{chunk-7IYBN7IA.js → chunk-OOF4UPC5.js} +22 -13
  76. package/{chunk-UIOEHFF6.js → chunk-OQHIVPG4.js} +1 -0
  77. package/{chunk-X4F26D5K.js → chunk-P5L7CXOC.js} +58 -33
  78. package/{chunk-5ORJGHTL.js → chunk-PDGKOTO7.js} +5 -5
  79. package/{chunk-UCPAVEQB.js → chunk-PYRUW7XN.js} +1 -1
  80. package/{chunk-SU3QL7YG.js → chunk-QT6PKHYJ.js} +1 -1
  81. package/{chunk-SN5XE6GQ.js → chunk-RPQXPZZF.js} +4 -4
  82. package/{chunk-ZN5AH4BY.js → chunk-RU4SD66C.js} +6 -6
  83. package/{chunk-YKFP6UGT.js → chunk-SOHTHFV2.js} +14 -14
  84. package/{chunk-CKOO42G5.js → chunk-UHJGXRJ4.js} +4 -4
  85. package/{chunk-CVCRAO6Q.js → chunk-UTV2AYEG.js} +9 -7
  86. package/{chunk-DQLB4NQ3.js → chunk-VPAZOH2D.js} +2 -2
  87. package/{chunk-MBS6CTZB.js → chunk-VZKUKCA6.js} +236 -1993
  88. package/{chunk-LNYHAKBP.js → chunk-W4S457LU.js} +1 -1
  89. package/chunk-WPORQFYN.js +74 -0
  90. package/{chunk-ET2CWLIJ.js → chunk-WXYLV624.js} +3 -3
  91. package/chunk-XFYFMTOM.js +92 -0
  92. package/{chunk-NV572QM3.js → chunk-YJMRHHGY.js} +15 -15
  93. package/{chunk-JBOUVTZX.js → chunk-YOIW77S2.js} +13 -2
  94. package/{chunk-ADBWFYJD.js → chunk-YPD3VJZW.js} +9 -9
  95. package/{chunk-DA7CTWT4.js → chunk-YWSEPJ7C.js} +5 -5
  96. package/{chunk-3V2QMRNN.js → chunk-ZL5RAEEB.js} +3 -3
  97. package/cliAgentConfigHelpers-WJBZQTLW.js +41 -0
  98. package/{commandRegistry-FI2IOQ3U.js → commandRegistry-VVMTPFAX.js} +85 -81
  99. package/{contentThunks-5LKNNDGY.js → contentThunks-N52O67MI.js} +25 -24
  100. package/{createAgentAutomationAction-TI4QG4CY.js → createAgentAutomationAction-ZC57YRSV.js} +25 -24
  101. package/{createDialogAction-TJ3JKLO4.js → createDialogAction-VQW5WDYX.js} +27 -26
  102. package/{createPageAction-GKXT6WEH.js → createPageAction-M5VDA7SC.js} +26 -25
  103. package/{dbSlice-LPMZ2DGJ.js → dbSlice-HP7G4LX3.js} +7 -7
  104. package/{deleteFile-EPUQHKPA.js → deleteFile-7VQGLK2V.js} +3 -3
  105. package/{dialogCommands-IWPXIZ5P.js → dialogCommands-JHMR2N2Y.js} +32 -30
  106. package/{dialogSlice-ZWNNS7GZ.js → dialogSlice-GRSVGDTF.js} +23 -22
  107. package/{dialogUsageCommand-ZCPPHPJ5.js → dialogUsageCommand-7KCPYGHG.js} +1 -1
  108. package/{docCreateCommands-HFSPKJSI.js → docCreateCommands-F2K3UPSQ.js} +28 -27
  109. package/{docDeleteCommands-CRL62POH.js → docDeleteCommands-XGXB5RFT.js} +29 -28
  110. package/{docReadCommands-QOTOX3XW.js → docReadCommands-7HWZZV6J.js} +28 -27
  111. package/{docStore-WYLRB7ED.js → docStore-KNZK6Y2G.js} +10 -10
  112. package/{docUpdateCommands-7BMH4MCA.js → docUpdateCommands-OZZ7NQII.js} +28 -27
  113. package/{fetchMessages-YY4SATNR.js → fetchMessages-M3QU7ZCQ.js} +1 -1
  114. package/{getPricing-OQXBJ6VZ.js → getPricing-2MNMXEVG.js} +3 -3
  115. package/{handleSendMessageAction-P27YP2DQ.js → handleSendMessageAction-SHIH74GJ.js} +46 -44
  116. package/hostCredentialCreate-X64WK4JD.js +357 -0
  117. package/index.js +5 -5
  118. package/{keys-P4ZDOVJW.js → keys-BEGDOTRL.js} +3 -1
  119. package/{localDialogRead-5VCMQQZF.js → localDialogRead-XRLAH4CZ.js} +1 -1
  120. package/{localRuntimeAdapter-GP6ZSSO3.js → localRuntimeAdapter-A7K3ABA6.js} +73 -66
  121. package/{machineCommands-6Z6H4BFX.js → machineCommands-DE3MR7CJ.js} +65 -60
  122. package/{machineWsRunDispatch-F2ZIXMYM.js → machineWsRunDispatch-R26P5V36.js} +65 -60
  123. package/{memberThunks-YSEFJF47.js → memberThunks-7WJAY5V6.js} +8 -8
  124. package/package.json +1 -1
  125. package/{projectArchive-PIGEOX3D.js → projectArchive-GGL5HLMD.js} +26 -25
  126. package/{providerPresetApply-ZYMLQA46.js → providerPresetApply-YXGV6NXB.js} +4 -4
  127. package/{providerRegistry-E34XWDLJ.js → providerRegistry-S6UL6UNA.js} +4 -4
  128. package/{read-DIIQBOOO.js → read-4VZQODSN.js} +3 -3
  129. package/{readDocTool-HXYGOEA7.js → readDocTool-AVD32RUJ.js} +1 -1
  130. package/{readlineWorkspace-UG25G7KC.js → readlineWorkspace-XKYKNL2I.js} +157 -100
  131. package/{removeDialogAgentAction-ALJDUJ2E.js → removeDialogAgentAction-FKL4BYMR.js} +17 -14
  132. package/{runAgentClientLoop-IO5F7TCZ.js → runAgentClientLoop-V7E2WBVM.js} +49 -46
  133. package/{runtimeDoctorCommands-PGAA47G5.js → runtimeDoctorCommands-QAI3MBKQ.js} +6 -6
  134. package/{secretCommands-ZCZ4KVET.js → secretCommands-4QS3HCA2.js} +3 -3
  135. package/{setDialogExtraReferencesAction-O3SVMD5A.js → setDialogExtraReferencesAction-TLIOLWWI.js} +10 -10
  136. package/{setPrimaryDialogAgentAction-HE7RVFFF.js → setPrimaryDialogAgentAction-2OLWRFYR.js} +18 -15
  137. package/{settingThunks-BWWJQG4L.js → settingThunks-UGBPCNYF.js} +12 -11
  138. package/{spaceCommands-UAELIFEI.js → spaceCommands-4KSLKVNF.js} +28 -27
  139. package/{streamAgentChatTurn-VUKZQYJR.js → streamAgentChatTurn-7FR7X2NU.js} +57 -54
  140. package/{switchDialogAgentAction-3VZS7SOS.js → switchDialogAgentAction-UZSAG2N5.js} +15 -12
  141. package/{tools-VRXJAVYI.js → tools-ZLKCC25W.js} +43 -40
  142. package/{tuiSummaryLlmCaller-TGCHZLSW.js → tuiSummaryLlmCaller-WC54MVGP.js} +10 -10
  143. package/{updateCommands-Q6CYAEYJ.js → updateCommands-4744PL3P.js} +3 -1
  144. package/{updateDialogTitleAction-MULWCJCW.js → updateDialogTitleAction-U53ZT7PJ.js} +38 -70
  145. package/usageCommand-F4IPVMIZ.js +32 -0
  146. package/usageRebuildCommand-HAW2AD5N.js +626 -0
  147. package/chunk-4LCOCOR5.js +0 -50
  148. package/chunk-7AUQ3WCW.js +0 -51
  149. package/chunk-ZRAU6T47.js +0 -56
  150. package/{agentFavoriteCommands-GAFEXKKP.js → agentFavoriteCommands-EDK743YA.js} +1 -1
  151. package/{agentGrantCommands-V5FOQKFD.js → agentGrantCommands-RQWK2TEV.js} +1 -1
  152. package/{agentPullCommand-2JMJP5BS.js → agentPullCommand-6EM3URVK.js} +1 -1
  153. package/{chunk-BTYQAODF.js → chunk-CZM5YTZ7.js} +3 -3
  154. package/{chunk-A2ZMIRLN.js → chunk-INN4LTAJ.js} +5 -5
  155. package/{chunk-XPHZK3PJ.js → chunk-JNKSDZFS.js} +3 -3
  156. package/{chunk-PV6JJAUB.js → chunk-TCZHTTUU.js} +8 -8
  157. package/{chunk-AKE53VMW.js → chunk-ZCWRMUWT.js} +0 -0
  158. package/{tableCommands-D7WR4QSM.js → tableCommands-MP6VFSVT.js} +3 -3
@@ -0,0 +1,227 @@
1
+ import {
2
+ canonicalizeToolName
3
+ } from "./chunk-ZCWRMUWT.js";
4
+ import {
5
+ isOwnedAgentKey
6
+ } from "./chunk-M2EJHDJP.js";
7
+ import {
8
+ isRecord
9
+ } from "./chunk-KUG52IAP.js";
10
+ import {
11
+ asTrimmedNonEmptyStringArray
12
+ } from "./chunk-I42VC5KR.js";
13
+
14
+ // packages/agent-runtime/runtimeToolSurface.ts
15
+ var DEFAULT_PRIVATE_NOLO_WORKSPACE_TOOLS = [
16
+ "listDialogs",
17
+ "readDialog",
18
+ "queryDialogsBySubjectRef",
19
+ "deleteDialogs",
20
+ "listAgents",
21
+ "readAgent",
22
+ "listSpaces",
23
+ "readSpace",
24
+ "readDoc",
25
+ "readSkillDoc",
26
+ "loadSkill",
27
+ "listTables",
28
+ "queryTableRows",
29
+ "cliWhoami",
30
+ "cliDoctor",
31
+ "list_cloud_resources",
32
+ "cloud_probe"
33
+ // cloud_exec 故意不在此清单:硬边界是「永不默认开 exec」。它只在 agent 显式启用时出现,
34
+ // 且只读 run 会被 HIGH_RISK_MUTATION_TOOL_NAMES 挡住(runtimeToolSurface.test.ts 钉住)。
35
+ ];
36
+ var DEFAULT_SUBTASK_REFERENCE_NOLO_WORKSPACE_TOOLS = [
37
+ "readDialog",
38
+ "queryDialogsBySubjectRef",
39
+ "readDoc",
40
+ "queryTableRows"
41
+ ];
42
+ var HIGH_RISK_MUTATION_TOOL_NAMES = [
43
+ "writeFile",
44
+ "editFile",
45
+ "deleteDialogs",
46
+ "deleteMemory",
47
+ "taskStop",
48
+ // 能力包(loadSkill 授予)里的写/删/部署/记忆写入/进程启动类工具:
49
+ // 只读 run 的授予通道会过同一份 blockedToolNames,名单缺项即可被绕过。
50
+ // 契约测试(runtimeToolSurface.test.ts)按名字关键字钉住 CAPABILITY_PACKS 的分类。
51
+ "applyEdit",
52
+ "applyLineEdits",
53
+ "launchProcess",
54
+ "rememberMemory",
55
+ "appFileWrite",
56
+ "appFileReplace",
57
+ "appDeploy",
58
+ "appDelete",
59
+ "createTable",
60
+ "addTableRow",
61
+ "addTableRows",
62
+ "updateTableRow",
63
+ "deleteTableRow",
64
+ // 媒体任务译文写回:改写 job 的 translate 产物(服务端零计费、无外部副作用),
65
+ // 但仍是「写」,只读 run 不该拿到写回能力;契约测试按名字关键字钉住这份分类。
66
+ "writeTranslations",
67
+ // 编排副作用:startAgentRun 会另起一次 run(子 run 的只读与否由调用方参数决定),
68
+ // controlAgentRun 能追加指令/停止它;只读 run 不应拿到这两个(review A-1)。
69
+ "startAgentRun",
70
+ "controlAgentRun",
71
+ // 受控云端执行:在用户拥有的云资源上跑任意命令,不可重放、副作用在云端。
72
+ // 硬边界:它永不进 DEFAULT_PRIVATE_NOLO_WORKSPACE_TOOLS(见该清单注释),
73
+ // 必须由 agent 显式启用才出现;这里进名单保证只读 run 即使被显式要求也拿不到。
74
+ "cloud_exec"
75
+ ];
76
+ function resolveReadOnlyToolConstraints(additionalBlockedTools) {
77
+ return {
78
+ blockedToolNames: [
79
+ ...HIGH_RISK_MUTATION_TOOL_NAMES,
80
+ ...additionalBlockedTools ?? []
81
+ ]
82
+ };
83
+ }
84
+ function applyToolSurfaceConstraints(surface, constraints) {
85
+ const allowed = constraints.allowedToolNames == null ? null : new Set(asTrimmedNonEmptyStringArray(constraints.allowedToolNames));
86
+ const blocked = new Set(asTrimmedNonEmptyStringArray(constraints.blockedToolNames ?? []));
87
+ const narrow = (names) => names.filter(
88
+ (name) => (allowed === null || allowed.has(name)) && !blocked.has(name)
89
+ );
90
+ return {
91
+ ...surface,
92
+ explicitToolNames: narrow(surface.explicitToolNames),
93
+ injectedToolNames: narrow(surface.injectedToolNames),
94
+ finalToolNames: narrow(surface.finalToolNames)
95
+ };
96
+ }
97
+ function resolveRequestToolSurface(args) {
98
+ const normalize = (name) => canonicalizeToolName(name.trim().replace(/^functions\./i, ""));
99
+ const names = (values) => new Set(values.map(normalize));
100
+ const allowed = args.profile?.allowedToolNames == null ? null : names(args.profile.allowedToolNames);
101
+ const blocked = names(args.profile?.blockedToolNames ?? []);
102
+ const supported = args.backend ? names(args.backend.toolNames) : null;
103
+ const scope = args.backend?.scopedToolNames ? names(args.backend.scopedToolNames) : null;
104
+ const filteredTools = [];
105
+ const finalToolNames = args.requestedToolNames.filter((toolName) => {
106
+ const name = normalize(toolName);
107
+ const reason = allowed && !allowed.has(name) ? "profile-not-allowed" : blocked.has(name) ? "profile-blocked" : supported && (!scope || scope.has(name)) && !supported.has(name) ? "backend-unsupported" : null;
108
+ if (!reason) return true;
109
+ filteredTools.push({ toolName, reason });
110
+ return false;
111
+ });
112
+ return { finalToolNames, filteredTools };
113
+ }
114
+ function uniqueToolNames(values) {
115
+ return [...new Set(asTrimmedNonEmptyStringArray(values))];
116
+ }
117
+ function canInjectPrivateDefaults(args) {
118
+ if (!args.currentUserId) return false;
119
+ if (args.invocationVisibility !== "private") return false;
120
+ if (args.agentOwnerId && args.agentOwnerId === args.currentUserId) return true;
121
+ if (args.trustedPrivateInvocation === true) return true;
122
+ return false;
123
+ }
124
+ function explicitOnlyReason(args) {
125
+ if (!args.currentUserId || !args.agentOwnerId) {
126
+ return "explicit-only-missing-identity";
127
+ }
128
+ if (args.invocationVisibility === "public") return "explicit-only-public";
129
+ if (args.invocationVisibility === "shared") return "explicit-only-shared";
130
+ if (args.agentOwnerId !== args.currentUserId) {
131
+ return "explicit-only-owner-mismatch";
132
+ }
133
+ return "explicit-only-anonymous";
134
+ }
135
+ function resolveRuntimeToolSurface(args) {
136
+ const explicitToolNames = uniqueToolNames(args.explicitToolNames ?? []);
137
+ if (canInjectPrivateDefaults(args)) {
138
+ const baseInjected = args.injectPrivateDefaults === false ? args.defaultInjectedToolNames ?? DEFAULT_SUBTASK_REFERENCE_NOLO_WORKSPACE_TOOLS : args.defaultInjectedToolNames ?? DEFAULT_PRIVATE_NOLO_WORKSPACE_TOOLS;
139
+ const injectedToolNames2 = uniqueToolNames([
140
+ ...baseInjected,
141
+ ...args.additionalRequiredToolNames ?? []
142
+ ]);
143
+ return {
144
+ explicitToolNames,
145
+ injectedToolNames: injectedToolNames2,
146
+ finalToolNames: uniqueToolNames([
147
+ ...explicitToolNames,
148
+ ...injectedToolNames2
149
+ ]),
150
+ auditReason: "private-authenticated-defaults"
151
+ };
152
+ }
153
+ const injectedToolNames = uniqueToolNames(args.additionalRequiredToolNames ?? []);
154
+ return {
155
+ explicitToolNames,
156
+ injectedToolNames,
157
+ finalToolNames: uniqueToolNames([
158
+ ...explicitToolNames,
159
+ ...injectedToolNames
160
+ ]),
161
+ auditReason: explicitOnlyReason(args)
162
+ };
163
+ }
164
+ function isPublicRuntimeAgentRef(value) {
165
+ return typeof value === "string" && value.startsWith("agent-pub-");
166
+ }
167
+ function inferOwnerIdFromRuntimeAgentKey(value) {
168
+ if (typeof value !== "string") return null;
169
+ const privateAgentMatch = value.match(/^agent-([^-]+)-(.+)$/);
170
+ if (privateAgentMatch && privateAgentMatch[1] !== "pub") {
171
+ return privateAgentMatch[1];
172
+ }
173
+ return null;
174
+ }
175
+ function resolveRuntimeToolSurfaceForAgent(args) {
176
+ const agentKey = typeof args.agentKey === "string" ? args.agentKey : "";
177
+ const currentUserId = typeof args.currentUserId === "string" ? args.currentUserId : "";
178
+ const inferredOwnerId = args.agentOwnerId ?? (currentUserId && isOwnedAgentKey(agentKey, currentUserId) ? currentUserId : inferOwnerIdFromRuntimeAgentKey(agentKey));
179
+ const publicRef = isPublicRuntimeAgentRef(agentKey);
180
+ const visibility = args.trustedPrivateInvocation === true ? "private" : publicRef || args.isPublic === true || args.sharingLevel === "public" ? "public" : "private";
181
+ return resolveRuntimeToolSurface({
182
+ explicitToolNames: args.explicitToolNames,
183
+ currentUserId: args.currentUserId,
184
+ agentOwnerId: inferredOwnerId,
185
+ invocationVisibility: visibility,
186
+ runtimeHost: args.runtimeHost,
187
+ trustedPrivateInvocation: args.trustedPrivateInvocation,
188
+ injectPrivateDefaults: args.injectPrivateDefaults,
189
+ defaultInjectedToolNames: args.defaultInjectedToolNames,
190
+ additionalRequiredToolNames: args.additionalRequiredToolNames
191
+ });
192
+ }
193
+ var SECRET_FIELD_NAMES = [
194
+ "apikey",
195
+ "api_key",
196
+ "secret",
197
+ "token",
198
+ "authorization",
199
+ "credential",
200
+ "password"
201
+ ];
202
+ function isSecretFieldName(key) {
203
+ const normalized = key.toLowerCase();
204
+ return SECRET_FIELD_NAMES.some((name) => normalized.includes(name));
205
+ }
206
+ function redactAgentRecordForWorkspaceTool(record) {
207
+ if (Array.isArray(record)) return record.map(redactAgentRecordForWorkspaceTool);
208
+ if (!isRecord(record)) return record;
209
+ const redacted = {};
210
+ for (const [key, value] of Object.entries(record)) {
211
+ if (isSecretFieldName(key)) {
212
+ redacted[key] = "[redacted]";
213
+ continue;
214
+ }
215
+ redacted[key] = Array.isArray(value) || isRecord(value) ? redactAgentRecordForWorkspaceTool(value) : value;
216
+ }
217
+ return redacted;
218
+ }
219
+
220
+ export {
221
+ HIGH_RISK_MUTATION_TOOL_NAMES,
222
+ resolveReadOnlyToolConstraints,
223
+ applyToolSurfaceConstraints,
224
+ resolveRequestToolSurface,
225
+ resolveRuntimeToolSurfaceForAgent,
226
+ redactAgentRecordForWorkspaceTool
227
+ };
@@ -1,6 +1,6 @@
1
1
  import {
2
2
  trimTrailingSlash
3
- } from "./chunk-PV6JJAUB.js";
3
+ } from "./chunk-TCZHTTUU.js";
4
4
  import {
5
5
  commandCodeModels,
6
6
  kimiCodeModels,
@@ -15,12 +15,6 @@ import {
15
15
  import {
16
16
  toErrorMessage
17
17
  } from "./chunk-HNMXYYJR.js";
18
- import {
19
- asOptionalFiniteNumber
20
- } from "./chunk-WWC7I6TA.js";
21
- import {
22
- asOptionalTrimmedString
23
- } from "./chunk-G3SUCT4W.js";
24
18
  import {
25
19
  PLATFORM_HOSTED_DEEPSEEK_FLASH_OFF_PEAK_PRICE,
26
20
  PLATFORM_HOSTED_DEEPSEEK_FLASH_PEAK_PRICE,
@@ -30,6 +24,12 @@ import {
30
24
  import {
31
25
  asTrimmedLowercaseString
32
26
  } from "./chunk-QSJ3HFEF.js";
27
+ import {
28
+ asOptionalFiniteNumber
29
+ } from "./chunk-WWC7I6TA.js";
30
+ import {
31
+ asOptionalTrimmedString
32
+ } from "./chunk-G3SUCT4W.js";
33
33
 
34
34
  // packages/agent-runtime/antigravityOAuth.ts
35
35
  var decodeBase64 = (s) => typeof Buffer !== "undefined" ? Buffer.from(s, "base64").toString("utf8") : typeof atob === "function" ? atob(s) : s;
@@ -4,22 +4,28 @@ import {
4
4
  import {
5
5
  getReadableCliDb
6
6
  } from "./chunk-J5JTMQIA.js";
7
+ import {
8
+ BIGMODEL_PROVIDER_TARGET,
9
+ buildCredentialUseGrant,
10
+ verifyCredentialUseGrant
11
+ } from "./chunk-XFYFMTOM.js";
12
+ import {
13
+ clearCliLocalRuntimePreparedAgentCache
14
+ } from "./chunk-D5RCRX4A.js";
15
+ import {
16
+ readCredentialAvailability
17
+ } from "./chunk-GSQNH63I.js";
7
18
  import {
8
19
  buildCreatedAgentRecord,
9
20
  buildUpdatedAgentRecord,
10
21
  normalizeAgentRecordForOutput,
11
22
  parseAgentUpdateArgs,
23
+ readBoundAgentCredential,
12
24
  refreshAgentRecordCache,
13
25
  resolveAgentRecordFromHybridStore,
14
26
  sanitizeAgentRecordForCliOutput,
15
27
  writeAgentRecord
16
- } from "./chunk-XDMGY5IU.js";
17
- import {
18
- clearCliLocalRuntimePreparedAgentCache
19
- } from "./chunk-M4NTDZG3.js";
20
- import {
21
- readCredentialAvailability
22
- } from "./chunk-GSQNH63I.js";
28
+ } from "./chunk-IF45XG7K.js";
23
29
  import {
24
30
  resolveCliAgentKeyInput
25
31
  } from "./chunk-NBTY7YJF.js";
@@ -150,7 +156,9 @@ async function runAgentUpdateCommand(args, deps = {}) {
150
156
  db,
151
157
  fetchImpl,
152
158
  fallbackFetchImpl,
153
- authToken
159
+ authToken,
160
+ credentialBroker: deps.credentialBroker,
161
+ hostApproval: deps.hostApproval
154
162
  });
155
163
  await writeAgentRecord({
156
164
  agentKey: built.agentKey,
@@ -159,7 +167,8 @@ async function runAgentUpdateCommand(args, deps = {}) {
159
167
  fetchImpl,
160
168
  serverUrl: built.serverUrl,
161
169
  userId,
162
- record: built.nextRecord
170
+ record: built.nextRecord,
171
+ remoteIncludeApiKey: !deps.hostApproval?.gateId
163
172
  });
164
173
  await refreshAgentRecordCache({
165
174
  db,
@@ -223,7 +232,9 @@ async function runAgentCreateCommand(args, deps = {}) {
223
232
  db,
224
233
  fetchImpl,
225
234
  fallbackFetchImpl,
226
- authToken
235
+ authToken,
236
+ credentialBroker: deps.credentialBroker,
237
+ hostApproval: deps.hostApproval
227
238
  });
228
239
  await writeAgentRecord({
229
240
  agentKey: built.agentKey,
@@ -232,7 +243,8 @@ async function runAgentCreateCommand(args, deps = {}) {
232
243
  fetchImpl,
233
244
  serverUrl: built.serverUrl,
234
245
  userId,
235
- record: built.nextRecord
246
+ record: built.nextRecord,
247
+ remoteIncludeApiKey: !deps.hostApproval?.gateId
236
248
  });
237
249
  await db.put(built.agentKey, {
238
250
  ...built.nextRecord,
@@ -244,16 +256,131 @@ async function runAgentCreateCommand(args, deps = {}) {
244
256
  let verifyResult;
245
257
  if (parsed.verify) {
246
258
  try {
247
- const { verifyCustomProvider } = await import("./agentProviderCommands-MN3ABDME.js");
259
+ const { verifyCustomProvider } = await import("./agentProviderCommands-Q5O33MED.js");
248
260
  const rec = built.nextRecord;
249
- verifyResult = await verifyCustomProvider({
250
- providerUrl: rec.customProviderUrl,
251
- apiKey: rec.apiKey,
252
- apiKeyHeader: rec.apiKeyHeader,
253
- model: rec.model,
254
- prompt: parsed.verifyPrompt,
255
- fetchImpl
256
- });
261
+ const verifyCredentialRef = typeof rec.credentialRef === "string" && rec.credentialRef.trim() ? rec.credentialRef.trim() : "";
262
+ if (verifyCredentialRef) {
263
+ const providerUrl = rec.customProviderUrl ?? "";
264
+ const hostGateId = (deps.hostApproval?.gateId ?? "").trim();
265
+ const confirmCredentialUse = hostGateId ? void 0 : deps.confirmCredentialUse;
266
+ let grantReason = "host-grant-unavailable: no in-process host approval in this entry point; credential not sent";
267
+ let grantedOrigin;
268
+ if (hostGateId) {
269
+ const gate = {
270
+ id: hostGateId,
271
+ kind: "confirm",
272
+ title: "Use pasted API key for this agent?",
273
+ body: `Target: ${providerUrl}`,
274
+ payload: { agentKey: built.agentKey, credentialRef: verifyCredentialRef }
275
+ };
276
+ const builtGrant = buildCredentialUseGrant({
277
+ gate,
278
+ result: { gateId: hostGateId, status: "completed", output: "confirmed" },
279
+ credentialRef: verifyCredentialRef,
280
+ agentKey: built.agentKey,
281
+ deviceId: deps.deviceId ?? "",
282
+ providerId: BIGMODEL_PROVIDER_TARGET.providerId,
283
+ providerUrl,
284
+ operations: ["verify"],
285
+ persistence: "os-store"
286
+ });
287
+ if (builtGrant.ok) {
288
+ const granted = verifyCredentialUseGrant({
289
+ grant: builtGrant.grant,
290
+ credentialRef: verifyCredentialRef,
291
+ agentKey: built.agentKey,
292
+ requestUrl: providerUrl,
293
+ operation: "verify"
294
+ });
295
+ if (granted.ok) {
296
+ grantedOrigin = builtGrant.grant.allowedOrigin;
297
+ } else {
298
+ grantReason = `host-grant-rejected: ${granted.reason}; credential not sent`;
299
+ }
300
+ } else {
301
+ grantReason = `host-grant-rejected: ${builtGrant.reason}; credential not sent`;
302
+ }
303
+ }
304
+ if (confirmCredentialUse) {
305
+ const gate = {
306
+ id: `credential-use-${built.agentKey}`,
307
+ kind: "confirm",
308
+ title: "Use pasted API key for this agent?",
309
+ body: `Target: ${providerUrl}`,
310
+ payload: { agentKey: built.agentKey, credentialRef: verifyCredentialRef }
311
+ };
312
+ const gateResult = await confirmCredentialUse(gate);
313
+ const builtGrant = buildCredentialUseGrant({
314
+ gate,
315
+ result: gateResult,
316
+ credentialRef: verifyCredentialRef,
317
+ agentKey: built.agentKey,
318
+ deviceId: deps.deviceId ?? "",
319
+ providerId: BIGMODEL_PROVIDER_TARGET.providerId,
320
+ providerUrl,
321
+ operations: ["verify"],
322
+ persistence: "os-store"
323
+ });
324
+ if (builtGrant.ok) {
325
+ const granted = verifyCredentialUseGrant({
326
+ grant: builtGrant.grant,
327
+ credentialRef: verifyCredentialRef,
328
+ agentKey: built.agentKey,
329
+ requestUrl: providerUrl,
330
+ operation: "verify"
331
+ });
332
+ if (granted.ok) {
333
+ grantedOrigin = builtGrant.grant.allowedOrigin;
334
+ } else {
335
+ grantReason = `host-grant-rejected: ${granted.reason}; credential not sent`;
336
+ }
337
+ } else {
338
+ grantReason = `host-grant-rejected: ${builtGrant.reason}; credential not sent`;
339
+ }
340
+ }
341
+ if (!grantedOrigin) {
342
+ if (grantReason.startsWith("host-grant-unavailable")) {
343
+ grantReason = "host-grant-unavailable: no in-process host approval for this credential/target in this entry point; credential not sent";
344
+ }
345
+ }
346
+ if (!grantedOrigin) {
347
+ verifyResult = {
348
+ ok: false,
349
+ providerUrl,
350
+ model: rec.model,
351
+ reason: grantReason
352
+ };
353
+ } else {
354
+ const secret = await readBoundAgentCredential(
355
+ verifyCredentialRef,
356
+ deps.credentialBroker
357
+ );
358
+ verifyResult = secret ? await verifyCustomProvider({
359
+ providerUrl,
360
+ apiKey: secret,
361
+ apiKeyHeader: rec.apiKeyHeader,
362
+ model: rec.model,
363
+ prompt: parsed.verifyPrompt,
364
+ fetchImpl,
365
+ // 实际请求目标必须等于授权的 origin;重定向一律拒绝。
366
+ allowedOrigin: grantedOrigin
367
+ }) : {
368
+ ok: false,
369
+ providerUrl,
370
+ model: rec.model,
371
+ reason: "host-grant-ok but credential is not readable from the OS store"
372
+ };
373
+ }
374
+ } else {
375
+ verifyResult = await verifyCustomProvider({
376
+ providerUrl: rec.customProviderUrl,
377
+ apiKey: rec.apiKey,
378
+ apiKeyHeader: rec.apiKeyHeader,
379
+ model: rec.model,
380
+ prompt: parsed.verifyPrompt,
381
+ fetchImpl
382
+ });
383
+ }
257
384
  } catch (error) {
258
385
  verifyResult = {
259
386
  ok: false,
@@ -0,0 +1,105 @@
1
+ import {
2
+ __commonJS
3
+ } from "./chunk-4VNS5WPM.js";
4
+
5
+ // node_modules/@babel/runtime/helpers/interopRequireDefault.js
6
+ var require_interopRequireDefault = __commonJS({
7
+ "node_modules/@babel/runtime/helpers/interopRequireDefault.js"(exports, module) {
8
+ function _interopRequireDefault(e) {
9
+ return e && e.__esModule ? e : {
10
+ "default": e
11
+ };
12
+ }
13
+ module.exports = _interopRequireDefault, module.exports.__esModule = true, module.exports["default"] = module.exports;
14
+ }
15
+ });
16
+
17
+ // node_modules/date-fns/_lib/requiredArgs/index.js
18
+ var require_requiredArgs = __commonJS({
19
+ "node_modules/date-fns/_lib/requiredArgs/index.js"(exports, module) {
20
+ "use strict";
21
+ Object.defineProperty(exports, "__esModule", {
22
+ value: true
23
+ });
24
+ exports.default = requiredArgs;
25
+ function requiredArgs(required, args) {
26
+ if (args.length < required) {
27
+ throw new TypeError(required + " argument" + (required > 1 ? "s" : "") + " required, but only " + args.length + " present");
28
+ }
29
+ }
30
+ module.exports = exports.default;
31
+ }
32
+ });
33
+
34
+ // node_modules/@babel/runtime/helpers/typeof.js
35
+ var require_typeof = __commonJS({
36
+ "node_modules/@babel/runtime/helpers/typeof.js"(exports, module) {
37
+ function _typeof(o) {
38
+ "@babel/helpers - typeof";
39
+ return module.exports = _typeof = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function(o2) {
40
+ return typeof o2;
41
+ } : function(o2) {
42
+ return o2 && "function" == typeof Symbol && o2.constructor === Symbol && o2 !== Symbol.prototype ? "symbol" : typeof o2;
43
+ }, module.exports.__esModule = true, module.exports["default"] = module.exports, _typeof(o);
44
+ }
45
+ module.exports = _typeof, module.exports.__esModule = true, module.exports["default"] = module.exports;
46
+ }
47
+ });
48
+
49
+ // node_modules/date-fns/toDate/index.js
50
+ var require_toDate = __commonJS({
51
+ "node_modules/date-fns/toDate/index.js"(exports, module) {
52
+ "use strict";
53
+ var _interopRequireDefault = require_interopRequireDefault().default;
54
+ Object.defineProperty(exports, "__esModule", {
55
+ value: true
56
+ });
57
+ exports.default = toDate;
58
+ var _typeof2 = _interopRequireDefault(require_typeof());
59
+ var _index = _interopRequireDefault(require_requiredArgs());
60
+ function toDate(argument) {
61
+ (0, _index.default)(1, arguments);
62
+ var argStr = Object.prototype.toString.call(argument);
63
+ if (argument instanceof Date || (0, _typeof2.default)(argument) === "object" && argStr === "[object Date]") {
64
+ return new Date(argument.getTime());
65
+ } else if (typeof argument === "number" || argStr === "[object Number]") {
66
+ return new Date(argument);
67
+ } else {
68
+ if ((typeof argument === "string" || argStr === "[object String]") && typeof console !== "undefined") {
69
+ console.warn("Starting with v2.0.0-beta.1 date-fns doesn't accept strings as date arguments. Please use `parseISO` to parse strings. See: https://github.com/date-fns/date-fns/blob/master/docs/upgradeGuide.md#string-arguments");
70
+ console.warn(new Error().stack);
71
+ }
72
+ return /* @__PURE__ */ new Date(NaN);
73
+ }
74
+ }
75
+ module.exports = exports.default;
76
+ }
77
+ });
78
+
79
+ // node_modules/date-fns/_lib/addLeadingZeros/index.js
80
+ var require_addLeadingZeros = __commonJS({
81
+ "node_modules/date-fns/_lib/addLeadingZeros/index.js"(exports, module) {
82
+ "use strict";
83
+ Object.defineProperty(exports, "__esModule", {
84
+ value: true
85
+ });
86
+ exports.default = addLeadingZeros;
87
+ function addLeadingZeros(number, targetLength) {
88
+ var sign = number < 0 ? "-" : "";
89
+ var output = Math.abs(number).toString();
90
+ while (output.length < targetLength) {
91
+ output = "0" + output;
92
+ }
93
+ return sign + output;
94
+ }
95
+ module.exports = exports.default;
96
+ }
97
+ });
98
+
99
+ export {
100
+ require_interopRequireDefault,
101
+ require_typeof,
102
+ require_requiredArgs,
103
+ require_toDate,
104
+ require_addLeadingZeros
105
+ };
@@ -1,7 +1,7 @@
1
1
  import {
2
2
  resolveBuiltinCapability,
3
3
  resolveBuiltinSkillEntry
4
- } from "./chunk-Y6M7KJOA.js";
4
+ } from "./chunk-EZFQ6XRV.js";
5
5
  import {
6
6
  noloAgentId
7
7
  } from "./chunk-Y6ORVLSS.js";