ucode-agent 1.20.1 → 1.21.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.
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "ucode-agent",
3
- "version": "1.20.1",
3
+ "version": "1.21.0",
4
4
  "description": "ucode - a terminal coding agent that reads, edits and runs your code, on NVIDIA and Cohere models.",
5
5
  "type": "module",
6
6
  "main": "ucode.js",
@@ -12,7 +12,6 @@ import { addBlock, BLOCK_NAMES } from './blocks.js';
12
12
  import { typeOf } from './types.js';
13
13
  import { runCommand, runCommands } from './shell.js';
14
14
  import { webSearch } from './web.js';
15
- import { lookAtApp } from './browser.js';
16
15
  import { createApp, TEMPLATE_NAMES, TEMPLATE_NOTES } from './scaffold.js';
17
16
  import { deploy } from './deploy.js';
18
17
  import { clip, READ_LINES } from './shared.js';
@@ -492,7 +491,14 @@ const run = {
492
491
  run_command: runCommand,
493
492
  run_commands: runCommands,
494
493
  web_search: webSearch,
495
- look_at_app: lookAtApp,
494
+ /**
495
+ * Loaded when it is used, not when ucode starts.
496
+ *
497
+ * browser.js pulls in playwright-core, which costs a second of start-up on
498
+ * its own. Nothing reaches for the browser until someone types /look, so
499
+ * nobody should wait for it before the first prompt.
500
+ */
501
+ look_at_app: async (args, opts) => (await import('./browser.js')).lookAtApp(args, opts),
496
502
  create_app: createApp,
497
503
  deploy,
498
504
  };
package/ucode.js CHANGED
@@ -12,12 +12,22 @@ import { readFile } from 'node:fs/promises';
12
12
  import { realpathSync } from 'node:fs';
13
13
  import { pathToFileURL, fileURLToPath } from 'node:url';
14
14
 
15
- import { Agent } from './src/core/loop.js';
16
- import { setModel, modelName, MODELS, DEFAULT_MODEL, ENV_FILE } from './src/core/provider.js';
17
15
  import { VERSION } from './src/core/version.js';
18
- import { Plain } from './src/ui/plain.js';
19
16
  import { blue, dim, sky } from './src/ui/theme.js';
20
17
 
18
+ /**
19
+ * The agent and the provider are loaded when a session actually starts.
20
+ *
21
+ * Between them they pull in the OpenAI SDK and every tool, which is most of
22
+ * the two and a half seconds ucode used to take before printing anything at
23
+ * all — including for `--version`, which needs none of it.
24
+ */
25
+ const heavy = () => Promise.all([
26
+ import('./src/core/loop.js'),
27
+ import('./src/core/provider.js'),
28
+ import('./src/ui/plain.js'),
29
+ ]);
30
+
21
31
  function parseArgs(argv) {
22
32
  const args = { debug: false, model: null, cwd: process.cwd(), help: false, plan: false, version: false };
23
33
 
@@ -34,7 +44,8 @@ function parseArgs(argv) {
34
44
  return args;
35
45
  }
36
46
 
37
- function usage() {
47
+ async function usage() {
48
+ const [, { MODELS, modelName, DEFAULT_MODEL, ENV_FILE }] = await heavy();
38
49
  const entries = Object.entries(MODELS);
39
50
  const width = Math.max(...entries.map(([, m]) => m.name.length));
40
51
  const models = entries
@@ -112,6 +123,8 @@ async function main() {
112
123
  }
113
124
  }
114
125
 
126
+ const [{ Agent }, { setModel }, { Plain }] = await heavy();
127
+
115
128
  if (args.model) {
116
129
  try {
117
130
  setModel(args.model);