coze_lab 0.1.45 → 0.1.46

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 (3) hide show
  1. package/README.md +9 -3
  2. package/index.js +35 -9
  3. package/package.json +1 -1
package/README.md CHANGED
@@ -83,10 +83,16 @@ For Python SDK uploads, `OTEL_ENDPOINT` is not used as the SDK base URL; set
83
83
 
84
84
  ## Supported Versions
85
85
 
86
+ The current hook scheme requires these local capabilities:
87
+
88
+ - `claude-code`: `settings.json` command hooks for `Stop` and `PostToolUse`.
89
+ - `codex`: `hooks.json` command hooks for `Stop` and `PostToolUse`.
90
+ - `openclaw`: plugin lifecycle/tool hooks with conversation access enabled.
91
+
86
92
  | Agent | Supported versions |
87
93
  |-------|--------------------|
88
- | `claude-code` | 1.2.x, 1.3.x, 1.4.x, 2.0.x, 2.1.x |
89
- | `codex` | 0.134.x, 1.0.x, 1.1.x |
90
- | `openclaw` | 2026.3.x, 2026.4.x, 2026.5.x |
94
+ | `claude-code` | >= 1.0.0 |
95
+ | `codex` | >= 0.134.0 |
96
+ | `openclaw` | >= 2026.3.0 |
91
97
 
92
98
  Versions outside this list show a warning but onboarding continues.
package/index.js CHANGED
@@ -459,12 +459,16 @@ function checkCozeloopSdk(pythonCmd, options = {}) {
459
459
  }
460
460
 
461
461
  // ─── 6. Version whitelist check ──────────────────────────────────────────────
462
- // Match on major.minor prefix: '1.3' matches 1.3.0, 1.3.2, 1.3.9
463
- const VERSION_WHITELIST = {
464
- 'claude-code': ['1.2', '1.3', '1.4', '2.0', '2.1'],
465
- 'codex': ['1.0', '1.1', '0.134'],
466
- 'openclaw': ['2026.3', '2026.4', '2026.5'],
462
+ // Forward-compatible lower bounds. Newer CLI releases are treated as
463
+ // supported by default because the hook selfcheck is the authoritative guard.
464
+ const VERSION_SUPPORT = {
465
+ 'claude-code': { min: '1.0.0', display: ['>= 1.0.0'] },
466
+ 'codex': { min: '0.134.0', display: ['>= 0.134.0'] },
467
+ 'openclaw': { min: '2026.3.0', display: ['>= 2026.3.0'] },
467
468
  };
469
+ const VERSION_WHITELIST = Object.fromEntries(
470
+ Object.entries(VERSION_SUPPORT).map(([agent, cfg]) => [agent, cfg.display]),
471
+ );
468
472
 
469
473
  const UPGRADE_CMD = {
470
474
  'claude-code': 'npm install -g @anthropic-ai/claude-code@latest',
@@ -473,15 +477,15 @@ const UPGRADE_CMD = {
473
477
  };
474
478
 
475
479
  function checkVersionWhitelist(agent, version) {
476
- const whitelist = VERSION_WHITELIST[agent] || [];
477
- const supported = whitelist.some(prefix => version.startsWith(prefix + '.') || version === prefix);
480
+ const support = VERSION_SUPPORT[agent];
481
+ const supported = support && isVersionAtLeast(version, support.min);
478
482
 
479
483
  if (supported) {
480
484
  ok(`${agent} v${version} — OK`);
481
485
  return;
482
486
  }
483
487
 
484
- const supportedList = whitelist.map(v => ` • ${v}.x`);
488
+ const supportedList = (support?.display || []).map(v => ` • ${v}`);
485
489
  warnBox([
486
490
  `⚠ WARNING: Unsupported ${agent} version: ${version}`,
487
491
  '',
@@ -491,10 +495,29 @@ function checkVersionWhitelist(agent, version) {
491
495
  'Trace reporting may not work correctly.',
492
496
  'Please upgrade and re-run:',
493
497
  ` ${UPGRADE_CMD[agent]}`,
494
- ` npx coze_lab --agent=${agent} ...`,
498
+ ' npx coze_lab --agent-id=<id>',
495
499
  ]);
496
500
  }
497
501
 
502
+ function parseVersionNumbers(version) {
503
+ const m = String(version || '').match(/(\d+(?:\.\d+){0,3})/);
504
+ return m ? m[1].split('.').map((part) => Number(part)) : [];
505
+ }
506
+
507
+ function isVersionAtLeast(version, minVersion) {
508
+ const got = parseVersionNumbers(version);
509
+ const min = parseVersionNumbers(minVersion);
510
+ if (!got.length || !min.length) return false;
511
+ const len = Math.max(got.length, min.length);
512
+ for (let i = 0; i < len; i += 1) {
513
+ const a = got[i] || 0;
514
+ const b = min[i] || 0;
515
+ if (a > b) return true;
516
+ if (a < b) return false;
517
+ }
518
+ return true;
519
+ }
520
+
498
521
  // ─── 7. Hook writers ─────────────────────────────────────────────────────────
499
522
  const fs = require('fs');
500
523
  const path = require('path');
@@ -1780,4 +1803,7 @@ module.exports = {
1780
1803
  getAgentPatToken,
1781
1804
  mergeJson,
1782
1805
  atomicWriteFileSync,
1806
+ VERSION_WHITELIST,
1807
+ VERSION_SUPPORT,
1808
+ isVersionAtLeast,
1783
1809
  };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "coze_lab",
3
- "version": "0.1.45",
3
+ "version": "0.1.46",
4
4
  "description": "Configure local AI agents (Claude Code, Codex, OpenClaw) to report traces to CozeLoop",
5
5
  "keywords": [
6
6
  "cozeloop",