farming-code 2.2.28 → 2.2.30

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 (83) hide show
  1. package/README.md +27 -90
  2. package/README.zh_cn.md +17 -90
  3. package/THIRD_PARTY_NOTICES.md +25 -6
  4. package/backend/acp/packaged-claude-acp.js +13 -0
  5. package/backend/acp/packaged-codex-acp.js +2 -2
  6. package/backend/acp-runtime.js +38 -17
  7. package/backend/acp-session-state.js +78 -88
  8. package/backend/acp-transcript.js +174 -9
  9. package/backend/agent-manager.js +27 -2
  10. package/backend/agent-session-history.js +45 -12
  11. package/backend/codex-session-history.js +1 -1
  12. package/backend/codex-transcript.js +0 -202
  13. package/backend/config-manager.js +44 -16
  14. package/backend/data/LICENSE.agent-browser +201 -0
  15. package/backend/data/runtime-dependency-manifest.json +199 -0
  16. package/backend/data/runtime-dependency-sources.json +5 -0
  17. package/backend/executable-discovery.js +7 -0
  18. package/backend/farming-agent-bootstrap.zh_cn.md +4 -2
  19. package/backend/farming-app-cli.js +161 -65
  20. package/backend/farming-cli.js +7 -59
  21. package/backend/index-html.js +31 -0
  22. package/backend/main-agent-skills.js +7 -28
  23. package/backend/npm-update-helper.js +43 -6
  24. package/backend/provider-adapters.js +10 -0
  25. package/backend/runtime-dependency-manager.js +759 -0
  26. package/backend/runtime-executable-invocation.js +20 -0
  27. package/backend/server-process-identity.js +47 -0
  28. package/backend/server.js +145 -204
  29. package/backend/slash-command-discovery.js +138 -1
  30. package/backend/storage-layout.js +30 -0
  31. package/backend/update-service.js +60 -914
  32. package/config/farming.deploy.env.example +1 -1
  33. package/config/farming.install.env.example +5 -1
  34. package/dist/acp/LICENSE.claude-agent-acp +191 -0
  35. package/dist/acp/LICENSE.claude-agent-sdk +1 -0
  36. package/dist/acp/claude-agent-acp-0.59.0.mjs +41606 -0
  37. package/dist/acp/{codex-acp-1.1.4.js → codex-acp-1.1.4.mjs} +387 -7
  38. package/dist/assets/{App-CM7Cy-l4.css → App-BKNUILuL.css} +1 -1
  39. package/dist/assets/App-Z1N7T0eM.js +695 -0
  40. package/dist/assets/{FileEditorMarkdownPreview-DYOMm-b1.js → FileEditorMarkdownPreview-Cs9cLv8a.js} +1 -1
  41. package/dist/assets/FileEditorPane-CNtuGjQ3.js +2 -0
  42. package/dist/assets/IconGlyphs-BClgag6E.js +1 -0
  43. package/dist/assets/ProjectFilesSection-K3GHuQ4U.js +12 -0
  44. package/dist/assets/ReviewPage-BRuxFaH5.js +3 -0
  45. package/dist/assets/code-dark-kLsQLvpf.css +1 -0
  46. package/dist/assets/{index-BzQO3pUr.js → index-D-zetSol.js} +2 -2
  47. package/dist/assets/main-DUTz-Rd2.css +1 -0
  48. package/dist/assets/{workspace-editor-monaco-tXA-udGx.js → workspace-editor-monaco-CJNwbpCy.js} +1 -1
  49. package/dist/assets/workspace-editor-monaco-CO9w8YV0.js +1 -0
  50. package/dist/assets/workspace-view-state-BjKPYp0E.js +7 -0
  51. package/dist/index.html +33 -3
  52. package/extensions/browser/backend/agent-browser-runtime.js +1041 -0
  53. package/extensions/browser/backend/browser-mcp-server.js +352 -0
  54. package/extensions/browser/backend/browser-resource-manager.js +921 -114
  55. package/extensions/browser/backend/browser-resource-store.js +47 -6
  56. package/extensions/browser/backend/browser-router.js +15 -2
  57. package/extensions/browser/backend/executable-discovery.js +164 -17
  58. package/extensions/browser/backend/managed-chromium-installer.js +593 -0
  59. package/extensions/browser/bin/farming-browser +384 -30
  60. package/extensions/browser/frontend/BrowserSidebarPortals.tsx +17 -19
  61. package/extensions/browser/frontend/BrowserViewer.tsx +217 -46
  62. package/extensions/browser/frontend/browser.css +68 -17
  63. package/extensions/browser/frontend/types.ts +13 -0
  64. package/extensions/browser/frontend/useBrowserResources.ts +18 -3
  65. package/index.html +32 -2
  66. package/package.json +10 -6
  67. package/shared/backend-connection-status.d.ts +12 -0
  68. package/shared/backend-connection-status.js +35 -4
  69. package/backend/agent-activity.js +0 -35
  70. package/backend/agent-memory-report.js +0 -583
  71. package/backend/bundle-update-helper.js +0 -113
  72. package/backend/codex-rollout-follower.js +0 -326
  73. package/dist/assets/App-CPG4WcjO.js +0 -658
  74. package/dist/assets/FileEditorPane-DXXq82aM.js +0 -2
  75. package/dist/assets/IconGlyphs-DrdPjYXr.js +0 -1
  76. package/dist/assets/ProjectFilesSection-CP66XVPl.js +0 -12
  77. package/dist/assets/ReviewPage-w21MEPD6.js +0 -3
  78. package/dist/assets/code-dark-BDjwj7Um.css +0 -1
  79. package/dist/assets/main-BlVUXfxa.css +0 -1
  80. package/dist/assets/workspace-editor-monaco-CFEfFNcA.js +0 -1
  81. package/dist/assets/workspace-view-state-BS_V8JVs.js +0 -7
  82. package/extensions/browser/backend/cdp-browser-runtime.js +0 -648
  83. package/extensions/browser/backend/cdp-client.js +0 -167
@@ -253,6 +253,358 @@ function createBrowserMcpServer(options = {}) {
253
253
  await browser.action(browserId, { kind: 'scroll', deltaY, deltaX })
254
254
  ));
255
255
 
256
+ server.registerTool('browser_history', {
257
+ title: 'Navigate Farming Browser History',
258
+ description: 'Go back, forward, or reload in the selected Browser Resource.',
259
+ inputSchema: {
260
+ browserId: z.string().min(1).describe(BROWSER_ID_DESCRIPTION),
261
+ operation: z.enum(['back', 'forward', 'reload']),
262
+ },
263
+ annotations: {
264
+ readOnlyHint: false,
265
+ destructiveHint: false,
266
+ idempotentHint: false,
267
+ openWorldHint: true,
268
+ },
269
+ }, async ({ browserId, operation }) => textResult(
270
+ await browser.action(browserId, { kind: operation })
271
+ ));
272
+
273
+ server.registerTool('browser_wait', {
274
+ title: 'Wait in Farming Browser',
275
+ description: [
276
+ 'Wait for one bounded page condition before continuing.',
277
+ 'For selector mode, provide a snapshot ref or CSS selector.',
278
+ PAGE_CONTENT_WARNING,
279
+ ].join(' '),
280
+ inputSchema: {
281
+ ...locatorSchema(),
282
+ mode: z.enum(['selector', 'time', 'url', 'load', 'function', 'text']).default('selector'),
283
+ value: z.string().optional().describe('URL pattern, load state, JavaScript expression, or page text.'),
284
+ durationMs: z.number().int().positive().optional(),
285
+ state: z.enum(['visible', 'hidden', 'attached', 'detached']).optional(),
286
+ timeoutMs: z.number().int().min(100).max(120_000).optional(),
287
+ },
288
+ annotations: {
289
+ readOnlyHint: false,
290
+ destructiveHint: true,
291
+ idempotentHint: false,
292
+ openWorldHint: true,
293
+ },
294
+ }, async ({ browserId, ...input }) => textResult(
295
+ await browser.action(browserId, { kind: 'wait', ...input })
296
+ ));
297
+
298
+ server.registerTool('browser_get', {
299
+ title: 'Read Farming Browser Value',
300
+ description: `Read an exact page or element value. ${PAGE_CONTENT_WARNING}`,
301
+ inputSchema: {
302
+ ...locatorSchema(),
303
+ what: z.enum(['text', 'html', 'value', 'attr', 'title', 'url', 'count', 'box', 'styles']),
304
+ attribute: z.string().min(1).optional(),
305
+ },
306
+ annotations: {
307
+ readOnlyHint: true,
308
+ openWorldHint: true,
309
+ },
310
+ }, async ({ browserId, ...input }) => textResult(
311
+ await browser.action(browserId, { kind: 'get', ...input })
312
+ ));
313
+
314
+ server.registerTool('browser_is', {
315
+ title: 'Check Farming Browser Element',
316
+ description: `Check whether an element is visible, enabled, or checked. ${PAGE_CONTENT_WARNING}`,
317
+ inputSchema: {
318
+ ...locatorSchema(),
319
+ state: z.enum(['visible', 'enabled', 'checked']),
320
+ },
321
+ annotations: {
322
+ readOnlyHint: true,
323
+ openWorldHint: true,
324
+ },
325
+ }, async ({ browserId, ...input }) => textResult(
326
+ await browser.action(browserId, { kind: 'is', ...input })
327
+ ));
328
+
329
+ server.registerTool('browser_eval', {
330
+ title: 'Evaluate JavaScript in Farming Browser',
331
+ description: [
332
+ 'Evaluate a JavaScript expression in the active page and return its serializable result.',
333
+ PAGE_CONTENT_WARNING,
334
+ ].join(' '),
335
+ inputSchema: {
336
+ browserId: z.string().min(1).describe(BROWSER_ID_DESCRIPTION),
337
+ expression: z.string().min(1).max(100_000),
338
+ },
339
+ annotations: {
340
+ readOnlyHint: false,
341
+ destructiveHint: true,
342
+ idempotentHint: false,
343
+ openWorldHint: true,
344
+ },
345
+ }, async ({ browserId, expression }) => textResult(
346
+ await browser.action(browserId, { kind: 'eval', expression })
347
+ ));
348
+
349
+ server.registerTool('browser_element_action', {
350
+ title: 'Perform Farming Browser Element Action',
351
+ description: [
352
+ 'Double-click, hover, focus, check, uncheck, scroll to, or highlight one element.',
353
+ 'Prefer a ref from the latest snapshot.',
354
+ PAGE_CONTENT_WARNING,
355
+ ].join(' '),
356
+ inputSchema: {
357
+ ...locatorSchema(),
358
+ operation: z.enum([
359
+ 'dblclick',
360
+ 'hover',
361
+ 'focus',
362
+ 'check',
363
+ 'uncheck',
364
+ 'scrollintoview',
365
+ 'highlight',
366
+ ]),
367
+ },
368
+ annotations: {
369
+ readOnlyHint: false,
370
+ destructiveHint: false,
371
+ idempotentHint: false,
372
+ openWorldHint: true,
373
+ },
374
+ }, async ({ browserId, operation, ref, selector }) => textResult(
375
+ await browser.action(browserId, { kind: operation, ref, selector })
376
+ ));
377
+
378
+ server.registerTool('browser_keyboard', {
379
+ title: 'Type into Focused Farming Browser Element',
380
+ description: 'Send text to the focused editor, including contenteditable and code editor surfaces.',
381
+ inputSchema: {
382
+ browserId: z.string().min(1).describe(BROWSER_ID_DESCRIPTION),
383
+ mode: z.enum(['type', 'inserttext']),
384
+ text: z.string(),
385
+ },
386
+ annotations: {
387
+ readOnlyHint: false,
388
+ destructiveHint: false,
389
+ idempotentHint: false,
390
+ openWorldHint: true,
391
+ },
392
+ }, async ({ browserId, mode, text }) => textResult(
393
+ await browser.action(browserId, { kind: 'keyboard', mode, text })
394
+ ));
395
+
396
+ server.registerTool('browser_select', {
397
+ title: 'Select Farming Browser Option',
398
+ description: `Select one or more values in a page select element. ${PAGE_CONTENT_WARNING}`,
399
+ inputSchema: {
400
+ ...locatorSchema(),
401
+ values: z.array(z.string()).min(1),
402
+ },
403
+ annotations: {
404
+ readOnlyHint: false,
405
+ destructiveHint: false,
406
+ idempotentHint: true,
407
+ openWorldHint: true,
408
+ },
409
+ }, async ({ browserId, ref, selector, values }) => textResult(
410
+ await browser.action(browserId, { kind: 'select', ref, selector, values })
411
+ ));
412
+
413
+ server.registerTool('browser_drag', {
414
+ title: 'Drag Farming Browser Element',
415
+ description: `Drag one page element onto another. ${PAGE_CONTENT_WARNING}`,
416
+ inputSchema: {
417
+ browserId: z.string().min(1).describe(BROWSER_ID_DESCRIPTION),
418
+ sourceRef: z.string().min(1).optional(),
419
+ sourceSelector: z.string().min(1).optional(),
420
+ targetRef: z.string().min(1).optional(),
421
+ targetSelector: z.string().min(1).optional(),
422
+ },
423
+ annotations: {
424
+ readOnlyHint: false,
425
+ destructiveHint: false,
426
+ idempotentHint: false,
427
+ openWorldHint: true,
428
+ },
429
+ }, async ({ browserId, ...input }) => textResult(
430
+ await browser.action(browserId, { kind: 'drag', ...input })
431
+ ));
432
+
433
+ server.registerTool('browser_find', {
434
+ title: 'Find and Act in Farming Browser',
435
+ description: [
436
+ 'Find an element by a semantic locator and perform one action.',
437
+ 'Use browser_snapshot refs when possible.',
438
+ PAGE_CONTENT_WARNING,
439
+ ].join(' '),
440
+ inputSchema: {
441
+ browserId: z.string().min(1).describe(BROWSER_ID_DESCRIPTION),
442
+ locator: z.enum(['role', 'text', 'label', 'placeholder', 'alt', 'title', 'testid', 'first', 'last', 'nth']),
443
+ value: z.string().min(1),
444
+ index: z.number().int().nonnegative().optional(),
445
+ action: z.enum(['click', 'fill', 'type', 'hover', 'focus', 'check', 'uncheck']).default('click'),
446
+ text: z.string().optional(),
447
+ name: z.string().optional(),
448
+ exact: z.boolean().optional(),
449
+ },
450
+ annotations: {
451
+ readOnlyHint: false,
452
+ destructiveHint: false,
453
+ idempotentHint: false,
454
+ openWorldHint: true,
455
+ },
456
+ }, async ({ browserId, ...input }) => textResult(
457
+ await browser.action(browserId, { kind: 'find', ...input })
458
+ ));
459
+
460
+ server.registerTool('browser_debug', {
461
+ title: 'Inspect Farming Browser Diagnostics',
462
+ description: [
463
+ 'Read or clear console messages and page errors, list network requests, or inspect one request.',
464
+ 'Network request details may contain application data.',
465
+ PAGE_CONTENT_WARNING,
466
+ ].join(' '),
467
+ inputSchema: {
468
+ browserId: z.string().min(1).describe(BROWSER_ID_DESCRIPTION),
469
+ source: z.enum(['console', 'errors', 'network']),
470
+ operation: z.enum(['read', 'requests', 'request']).optional(),
471
+ clear: z.boolean().optional(),
472
+ requestId: z.string().optional(),
473
+ filter: z.string().optional(),
474
+ resourceType: z.string().optional(),
475
+ method: z.string().optional(),
476
+ status: z.string().optional(),
477
+ },
478
+ annotations: {
479
+ readOnlyHint: false,
480
+ destructiveHint: true,
481
+ idempotentHint: false,
482
+ openWorldHint: true,
483
+ },
484
+ }, async ({ browserId, source, operation, ...input }) => {
485
+ const action = source === 'network'
486
+ ? { kind: 'network', operation: operation === 'request' ? 'request' : 'requests', ...input }
487
+ : { kind: source, clear: input.clear };
488
+ return textResult(await browser.action(browserId, action));
489
+ });
490
+
491
+ server.registerTool('browser_cookies', {
492
+ title: 'Manage Farming Browser Cookies',
493
+ description: 'Get, set, or clear cookies in the selected Browser Resource. Cookie values may be sensitive.',
494
+ inputSchema: {
495
+ browserId: z.string().min(1).describe(BROWSER_ID_DESCRIPTION),
496
+ operation: z.enum(['get', 'set', 'clear']).default('get'),
497
+ name: z.string().optional(),
498
+ value: z.string().optional(),
499
+ url: z.string().optional(),
500
+ domain: z.string().optional(),
501
+ path: z.string().optional(),
502
+ httpOnly: z.boolean().optional(),
503
+ secure: z.boolean().optional(),
504
+ sameSite: z.enum(['Strict', 'Lax', 'None']).optional(),
505
+ expires: z.number().optional(),
506
+ },
507
+ annotations: {
508
+ readOnlyHint: false,
509
+ destructiveHint: true,
510
+ idempotentHint: false,
511
+ openWorldHint: true,
512
+ },
513
+ }, async ({ browserId, ...input }) => textResult(
514
+ await browser.action(browserId, { kind: 'cookies', ...input })
515
+ ));
516
+
517
+ server.registerTool('browser_storage', {
518
+ title: 'Manage Farming Browser Web Storage',
519
+ description: 'Get, set, or clear localStorage or sessionStorage in the active page origin.',
520
+ inputSchema: {
521
+ browserId: z.string().min(1).describe(BROWSER_ID_DESCRIPTION),
522
+ storageType: z.enum(['local', 'session']),
523
+ operation: z.enum(['get', 'set', 'clear']).default('get'),
524
+ key: z.string().optional(),
525
+ value: z.string().optional(),
526
+ },
527
+ annotations: {
528
+ readOnlyHint: false,
529
+ destructiveHint: true,
530
+ idempotentHint: false,
531
+ openWorldHint: true,
532
+ },
533
+ }, async ({ browserId, ...input }) => textResult(
534
+ await browser.action(browserId, { kind: 'storage', ...input })
535
+ ));
536
+
537
+ server.registerTool('browser_frame', {
538
+ title: 'Select Farming Browser Frame',
539
+ description: 'Switch the action context to one iframe or back to the main document.',
540
+ inputSchema: {
541
+ ...locatorSchema(),
542
+ main: z.boolean().optional().describe('Set true to return to the main document.'),
543
+ },
544
+ annotations: {
545
+ readOnlyHint: false,
546
+ destructiveHint: false,
547
+ idempotentHint: true,
548
+ openWorldHint: true,
549
+ },
550
+ }, async ({ browserId, ...input }) => textResult(
551
+ await browser.action(browserId, { kind: 'frame', ...input })
552
+ ));
553
+
554
+ server.registerTool('browser_dialog', {
555
+ title: 'Handle Farming Browser Dialog',
556
+ description: 'Check, accept, or dismiss the active alert, confirm, prompt, or beforeunload dialog.',
557
+ inputSchema: {
558
+ browserId: z.string().min(1).describe(BROWSER_ID_DESCRIPTION),
559
+ operation: z.enum(['status', 'accept', 'dismiss']).default('status'),
560
+ text: z.string().optional().describe('Prompt text supplied when accepting.'),
561
+ },
562
+ annotations: {
563
+ readOnlyHint: false,
564
+ destructiveHint: false,
565
+ idempotentHint: false,
566
+ openWorldHint: true,
567
+ },
568
+ }, async ({ browserId, operation, text }) => textResult(
569
+ await browser.action(browserId, { kind: 'dialog', operation, text })
570
+ ));
571
+
572
+ server.registerTool('browser_upload', {
573
+ title: 'Upload Project Files in Farming Browser',
574
+ description: 'Upload files that resolve inside this Browser Resource Project workspace.',
575
+ inputSchema: {
576
+ ...locatorSchema(),
577
+ files: z.array(z.string().min(1)).min(1).max(20),
578
+ timeoutMs: z.number().int().min(100).max(120_000).optional(),
579
+ },
580
+ annotations: {
581
+ readOnlyHint: false,
582
+ destructiveHint: false,
583
+ idempotentHint: false,
584
+ openWorldHint: true,
585
+ },
586
+ }, async ({ browserId, ...input }) => textResult(
587
+ await browser.action(browserId, { kind: 'upload', ...input })
588
+ ));
589
+
590
+ server.registerTool('browser_download', {
591
+ title: 'Download into Farming Project',
592
+ description: 'Download a file to a new path inside this Browser Resource Project workspace.',
593
+ inputSchema: {
594
+ ...locatorSchema(),
595
+ path: z.string().min(1),
596
+ timeoutMs: z.number().int().min(100).max(120_000).optional(),
597
+ },
598
+ annotations: {
599
+ readOnlyHint: false,
600
+ destructiveHint: false,
601
+ idempotentHint: false,
602
+ openWorldHint: true,
603
+ },
604
+ }, async ({ browserId, ...input }) => textResult(
605
+ await browser.action(browserId, { kind: 'download', ...input })
606
+ ));
607
+
256
608
  return server;
257
609
  }
258
610