@unity-china/codely-cli 1.0.0-beta.52 → 1.0.0-rc.10

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.
@@ -5,7 +5,7 @@
5
5
  */
6
6
  /**
7
7
  * @license
8
- * Copyright 2025 Qwen
8
+ * Copyright 2026
9
9
  * SPDX-License-Identifier: Apache-2.0
10
10
  */
11
11
  /**
@@ -13,17 +13,43 @@
13
13
  * Copyright 2025 Codely
14
14
  * SPDX-License-Identifier: Apache-2.0
15
15
  *
16
- * Modified OAuth2 implementation using direct token callback:
17
- * - Instead of using redirect_uri, the callback URL is passed in the state parameter
18
- * - The server returns tokens directly in the callback as base64-encoded code parameter
19
- * - No token exchange step is needed, tokens are decoded directly from the callback
20
- * - Implements credential caching and automatic token refresh similar to qwenOAuth2.ts
16
+ * Codely OAuth2 implementation:
17
+ * - Prefer device flow for IDE/CLI-friendly authentication.
18
+ * - Keep legacy browser callback flow as a fallback path.
19
+ * - Implements credential caching and automatic token refresh.
21
20
  */
22
21
  /**
23
22
  * @license
24
23
  * Copyright 2025 Codely
25
24
  * SPDX-License-Identifier: Apache-2.0
26
25
  */
26
+ /**
27
+ * @license
28
+ * Copyright 2026 Codely
29
+ * SPDX-License-Identifier: Apache-2.0
30
+ */
31
+ /**
32
+ * @license
33
+ * Copyright 2025 Qwen
34
+ * SPDX-License-Identifier: Apache-2.0
35
+ */
36
+ /**
37
+ * @license
38
+ * Copyright 2025 Codely
39
+ * SPDX-License-Identifier: Apache-2.0
40
+ *
41
+ * LiteLLMLogger: Reports API call data to LiteLLM Proxy Report API.
42
+ *
43
+ * Features:
44
+ * - Triggers Langfuse callbacks for observability
45
+ * - Writes to LiteLLM DB SpendLogs for cost tracking
46
+ * - Records TTFT (Time to First Token) for streaming responses
47
+ *
48
+ * Design:
49
+ * - Always enabled (same as CodelyLogger)
50
+ * - Uses Codely OAuth cli_api_key for authentication
51
+ * - All network errors are silently handled to not affect CLI operation
52
+ */
27
53
  /**
28
54
  * @license
29
55
  * Copyright 2026 Google LLC
@@ -31,21 +57,54 @@
31
57
  */
32
58
  /**
33
59
  * @license
34
- * Copyright 2026
60
+ * Copyright 2026 Google LLC
61
+ * ---
62
+ * Ported from packages/cli/src/ui/scheduling/commandQueue.ts as part of
63
+ * Phase 2 (Queue Ownership) migration. The CLI file now re-exports these
64
+ * symbols and keeps scope helpers for its own use.
35
65
  * SPDX-License-Identifier: Apache-2.0
36
66
  */
37
67
  /**
38
68
  * @license
39
- * Copyright 2026 Codely
69
+ * Copyright 2026 Google LLC
40
70
  * SPDX-License-Identifier: Apache-2.0
71
+ *
72
+ * ---
73
+ * Phase 2 (Queue Ownership) migration: this file is now a thin CLI-side
74
+ * adapter. The command-queue singleton and its API live in
75
+ * `@codely/codely-cli-core` (`packages/core/src/core/messageQueueManager.ts`)
76
+ * so the core agent loop can consume the same queue the CLI UI observes.
77
+ *
78
+ * This module re-exports the core API 1:1 and narrows the transparent
79
+ * `completionEvent?: unknown` field on `QueuedCommand` to the CLI-specific
80
+ * `TaskCompletionEvent` shape — preserving the existing CLI type surface
81
+ * and keeping all current imports source-compatible.
41
82
  */
42
83
 
43
84
  Bundled license information:
44
85
 
86
+ web-streams-polyfill/dist/ponyfill.es2018.js:
87
+ /**
88
+ * @license
89
+ * web-streams-polyfill v3.3.3
90
+ * Copyright 2024 Mattias Buelens, Diwank Singh Tomer and other contributors.
91
+ * This code is released under the MIT license.
92
+ * SPDX-License-Identifier: MIT
93
+ */
94
+
95
+ fetch-blob/index.js:
96
+ /*! fetch-blob. MIT License. Jimmy Wärting <https://jimmy.warting.se/opensource> */
97
+
98
+ formdata-polyfill/esm.min.js:
99
+ undici/lib/web/fetch/body.js:
100
+ /*! formdata-polyfill. MIT License. Jimmy Wärting <https://jimmy.warting.se/opensource> */
101
+
102
+ node-domexception/index.js:
103
+ /*! node-domexception. MIT License. Jimmy Wärting <https://jimmy.warting.se/opensource> */
104
+
45
105
  safe-buffer/index.js:
46
106
  /*! safe-buffer. MIT License. Feross Aboukhadijeh <https://feross.org/opensource> */
47
107
 
48
- @google/genai/dist/node/index.mjs:
49
108
  @google/genai/dist/node/index.mjs:
50
109
  /**
51
110
  * @license
@@ -94,9 +153,6 @@ long/umd/index.js:
94
153
  * SPDX-License-Identifier: Apache-2.0
95
154
  */
96
155
 
97
- uri-js/dist/es5/uri.all.js:
98
- /** @license URI.js v4.4.1 (c) 2011 Gary Court. License: http://github.com/garycourt/uri-js */
99
-
100
156
  mime-db/index.js:
101
157
  /*!
102
158
  * mime-db
@@ -159,10 +215,6 @@ queue-microtask/index.js:
159
215
  run-parallel/index.js:
160
216
  /*! run-parallel. MIT License. Feross Aboukhadijeh <https://feross.org/opensource> */
161
217
 
162
- undici/lib/web/fetch/body.js:
163
- formdata-polyfill/esm.min.js:
164
- /*! formdata-polyfill. MIT License. Jimmy Wärting <https://jimmy.warting.se/opensource> */
165
-
166
218
  undici/lib/web/websocket/frame.js:
167
219
  /*! ws. MIT License. Einar Otto Stangvik <einaros@gmail.com> */
168
220
 
@@ -201,21 +253,6 @@ mcp-proxy/dist/stdio-CfAxSAGj.js:
201
253
  */
202
254
  /** @license URI.js v4.4.1 (c) 2011 Gary Court. License: http://github.com/garycourt/uri-js */
203
255
 
204
- web-streams-polyfill/dist/ponyfill.es2018.js:
205
- /**
206
- * @license
207
- * web-streams-polyfill v3.3.3
208
- * Copyright 2024 Mattias Buelens, Diwank Singh Tomer and other contributors.
209
- * This code is released under the MIT license.
210
- * SPDX-License-Identifier: MIT
211
- */
212
-
213
- fetch-blob/index.js:
214
- /*! fetch-blob. MIT License. Jimmy Wärting <https://jimmy.warting.se/opensource> */
215
-
216
- node-domexception/index.js:
217
- /*! node-domexception. MIT License. Jimmy Wärting <https://jimmy.warting.se/opensource> */
218
-
219
256
  react/cjs/react.production.js:
220
257
  /**
221
258
  * @license React
@@ -238,10 +275,10 @@ react/cjs/react.development.js:
238
275
  * LICENSE file in the root directory of this source tree.
239
276
  */
240
277
 
241
- react-reconciler/cjs/react-reconciler-constants.production.js:
278
+ react/cjs/react-jsx-runtime.production.js:
242
279
  /**
243
280
  * @license React
244
- * react-reconciler-constants.production.js
281
+ * react-jsx-runtime.production.js
245
282
  *
246
283
  * Copyright (c) Meta Platforms, Inc. and affiliates.
247
284
  *
@@ -249,10 +286,10 @@ react-reconciler/cjs/react-reconciler-constants.production.js:
249
286
  * LICENSE file in the root directory of this source tree.
250
287
  */
251
288
 
252
- react-reconciler/cjs/react-reconciler-constants.development.js:
289
+ react/cjs/react-jsx-runtime.development.js:
253
290
  /**
254
291
  * @license React
255
- * react-reconciler-constants.development.js
292
+ * react-jsx-runtime.development.js
256
293
  *
257
294
  * Copyright (c) Meta Platforms, Inc. and affiliates.
258
295
  *
@@ -260,10 +297,10 @@ react-reconciler/cjs/react-reconciler-constants.development.js:
260
297
  * LICENSE file in the root directory of this source tree.
261
298
  */
262
299
 
263
- scheduler/cjs/scheduler.production.js:
300
+ react-reconciler/cjs/react-reconciler-constants.production.js:
264
301
  /**
265
302
  * @license React
266
- * scheduler.production.js
303
+ * react-reconciler-constants.production.js
267
304
  *
268
305
  * Copyright (c) Meta Platforms, Inc. and affiliates.
269
306
  *
@@ -271,10 +308,10 @@ scheduler/cjs/scheduler.production.js:
271
308
  * LICENSE file in the root directory of this source tree.
272
309
  */
273
310
 
274
- scheduler/cjs/scheduler.development.js:
311
+ react-reconciler/cjs/react-reconciler-constants.development.js:
275
312
  /**
276
313
  * @license React
277
- * scheduler.development.js
314
+ * react-reconciler-constants.development.js
278
315
  *
279
316
  * Copyright (c) Meta Platforms, Inc. and affiliates.
280
317
  *
@@ -282,10 +319,10 @@ scheduler/cjs/scheduler.development.js:
282
319
  * LICENSE file in the root directory of this source tree.
283
320
  */
284
321
 
285
- react-reconciler/cjs/react-reconciler.production.js:
322
+ scheduler/cjs/scheduler.production.js:
286
323
  /**
287
324
  * @license React
288
- * react-reconciler.production.js
325
+ * scheduler.production.js
289
326
  *
290
327
  * Copyright (c) Meta Platforms, Inc. and affiliates.
291
328
  *
@@ -293,10 +330,10 @@ react-reconciler/cjs/react-reconciler.production.js:
293
330
  * LICENSE file in the root directory of this source tree.
294
331
  */
295
332
 
296
- react-reconciler/cjs/react-reconciler.development.js:
333
+ scheduler/cjs/scheduler.development.js:
297
334
  /**
298
335
  * @license React
299
- * react-reconciler.development.js
336
+ * scheduler.development.js
300
337
  *
301
338
  * Copyright (c) Meta Platforms, Inc. and affiliates.
302
339
  *
@@ -304,19 +341,21 @@ react-reconciler/cjs/react-reconciler.development.js:
304
341
  * LICENSE file in the root directory of this source tree.
305
342
  */
306
343
 
307
- react-devtools-core/dist/backend.js:
344
+ react-reconciler/cjs/react-reconciler.production.js:
308
345
  /**
309
346
  * @license React
310
- * react-debug-tools.production.js
347
+ * react-reconciler.production.js
311
348
  *
312
349
  * Copyright (c) Meta Platforms, Inc. and affiliates.
313
350
  *
314
351
  * This source code is licensed under the MIT license found in the
315
352
  * LICENSE file in the root directory of this source tree.
316
353
  */
354
+
355
+ react-reconciler/cjs/react-reconciler.development.js:
317
356
  /**
318
357
  * @license React
319
- * react.production.js
358
+ * react-reconciler.development.js
320
359
  *
321
360
  * Copyright (c) Meta Platforms, Inc. and affiliates.
322
361
  *
@@ -324,21 +363,19 @@ react-devtools-core/dist/backend.js:
324
363
  * LICENSE file in the root directory of this source tree.
325
364
  */
326
365
 
327
- react/cjs/react-jsx-runtime.production.js:
366
+ react-devtools-core/dist/backend.js:
328
367
  /**
329
368
  * @license React
330
- * react-jsx-runtime.production.js
369
+ * react-debug-tools.production.js
331
370
  *
332
371
  * Copyright (c) Meta Platforms, Inc. and affiliates.
333
372
  *
334
373
  * This source code is licensed under the MIT license found in the
335
374
  * LICENSE file in the root directory of this source tree.
336
375
  */
337
-
338
- react/cjs/react-jsx-runtime.development.js:
339
376
  /**
340
377
  * @license React
341
- * react-jsx-runtime.development.js
378
+ * react.production.js
342
379
  *
343
380
  * Copyright (c) Meta Platforms, Inc. and affiliates.
344
381
  *
@@ -1,17 +1,27 @@
1
- # Plan Mode policy: deny-all + read-only whitelist + plans dir write exception.
1
+ # Plan Mode policy: default-ask + explicit allow for exploration/planning tools.
2
2
  # Active only when ApprovalMode = "plan".
3
3
  #
4
+ # Design:
5
+ # - No blanket deny-all: tools default to ASK_USER (interactive) or ALLOW (non-interactive).
6
+ # - Explicit ALLOW for exploration/planning tools (including shell).
7
+ # - Conditional ALLOW for write_file/replace (plans directory only).
8
+ #
4
9
  # Priority bands (tiers):
5
10
  # - Default policies (TOML): 1 + priority/1000
6
- # 60: Catch-all deny for plan mode (becomes 1.060)
7
- # 70: Explicit allows for plan mode (becomes 1.070, overrides deny)
11
+ # 70: Explicit allows and ask rules for plan mode (becomes 1.070, overrides deny)
12
+ #
13
+ # Non-interactive plan mode:
14
+ # The PolicyEngine converts ASK_USER → DENY for non-interactive sessions.
15
+ # When entering plan mode in non-interactive, Config.setApprovalMode()
16
+ # sets the PolicyEngine default decision to ALLOW, so tools without
17
+ # explicit rules are available by default.
8
18
 
9
- # --- Catch-all deny for plan mode ---
19
+ # --- Explicit allows for plan mode ---
10
20
  [[rule]]
11
- decision = "deny"
12
- priority = 60
21
+ toolName = "run_shell_command"
22
+ decision = "allow"
23
+ priority = 70
13
24
  modes = ["plan"]
14
- deny_message = "You are in Plan Mode. Only read/search tools and writing plans to the plans directory are allowed. Use exit_plan_mode to request approval for your plan."
15
25
 
16
26
  # --- Read-only tools allowed in plan mode ---
17
27
  [[rule]]
@@ -44,6 +54,12 @@ decision = "allow"
44
54
  priority = 70
45
55
  modes = ["plan"]
46
56
 
57
+ [[rule]]
58
+ toolName = "analyze_multimedia"
59
+ decision = "allow"
60
+ priority = 70
61
+ modes = ["plan"]
62
+
47
63
  [[rule]]
48
64
  toolName = "web_search"
49
65
  decision = "allow"
@@ -57,7 +73,25 @@ priority = 70
57
73
  modes = ["plan"]
58
74
 
59
75
  [[rule]]
60
- toolName = "todo_write"
76
+ toolName = "job_create"
77
+ decision = "allow"
78
+ priority = 70
79
+ modes = ["plan"]
80
+
81
+ [[rule]]
82
+ toolName = "job_get"
83
+ decision = "allow"
84
+ priority = 70
85
+ modes = ["plan"]
86
+
87
+ [[rule]]
88
+ toolName = "job_update"
89
+ decision = "allow"
90
+ priority = 70
91
+ modes = ["plan"]
92
+
93
+ [[rule]]
94
+ toolName = "job_list"
61
95
  decision = "allow"
62
96
  priority = 70
63
97
  modes = ["plan"]
@@ -73,6 +107,14 @@ priority = 70
73
107
  modes = ["plan"]
74
108
  argsPattern = "\"file_path\"\\s*:\\s*\"[^\"]*[/\\\\]+\\.codely-cli[/\\\\]+tmp[/\\\\]+[a-f0-9]{64}[/\\\\]+plans[/\\\\]+[a-zA-Z0-9_\\-][a-zA-Z0-9_\\-.]*\\.md\""
75
109
 
110
+ # write_file outside the plans directory requires approval (interactive)
111
+ # or is denied (non-interactive via ask-downgrade)
112
+ [[rule]]
113
+ toolName = "write_file"
114
+ decision = "ask_user"
115
+ priority = 65
116
+ modes = ["plan"]
117
+
76
118
  [[rule]]
77
119
  toolName = "replace"
78
120
  decision = "allow"
@@ -80,6 +122,14 @@ priority = 70
80
122
  modes = ["plan"]
81
123
  argsPattern = "\"file_path\"\\s*:\\s*\"[^\"]*[/\\\\]+\\.codely-cli[/\\\\]+tmp[/\\\\]+[a-f0-9]{64}[/\\\\]+plans[/\\\\]+[a-zA-Z0-9_\\-][a-zA-Z0-9_\\-.]*\\.md\""
82
124
 
125
+ # replace outside the plans directory requires approval (interactive)
126
+ # or is denied (non-interactive via ask-downgrade)
127
+ [[rule]]
128
+ toolName = "replace"
129
+ decision = "ask_user"
130
+ priority = 65
131
+ modes = ["plan"]
132
+
83
133
  # --- exit_plan_mode requires user approval ---
84
134
  [[rule]]
85
135
  toolName = "exit_plan_mode"
@@ -46,10 +46,24 @@ toolName = "analyze_multimedia"
46
46
  decision = "allow"
47
47
  priority = 50
48
48
 
49
- # todo_write is a planning/tracking tool that doesn't modify the filesystem.
50
- # It was always auto-approved (shouldConfirmExecute returns false).
49
+ # Job tools are planning/tracking tools that don't modify the filesystem.
51
50
  [[rule]]
52
- toolName = "todo_write"
51
+ toolName = "job_create"
52
+ decision = "allow"
53
+ priority = 50
54
+
55
+ [[rule]]
56
+ toolName = "job_get"
57
+ decision = "allow"
58
+ priority = 50
59
+
60
+ [[rule]]
61
+ toolName = "job_update"
62
+ decision = "allow"
63
+ priority = 50
64
+
65
+ [[rule]]
66
+ toolName = "job_list"
53
67
  decision = "allow"
54
68
  priority = 50
55
69