@codemieai/code 0.0.40 → 0.0.41

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 (75) hide show
  1. package/README.md +2 -3
  2. package/bin/codemie-opencode.js +8 -1
  3. package/dist/agents/codemie-code/skills/index.d.ts +4 -0
  4. package/dist/agents/codemie-code/skills/index.d.ts.map +1 -1
  5. package/dist/agents/codemie-code/skills/index.js +4 -0
  6. package/dist/agents/codemie-code/skills/index.js.map +1 -1
  7. package/dist/agents/codemie-code/skills/sync/SkillSync.d.ts +52 -0
  8. package/dist/agents/codemie-code/skills/sync/SkillSync.d.ts.map +1 -0
  9. package/dist/agents/codemie-code/skills/sync/SkillSync.js +165 -0
  10. package/dist/agents/codemie-code/skills/sync/SkillSync.js.map +1 -0
  11. package/dist/agents/core/AgentCLI.d.ts.map +1 -1
  12. package/dist/agents/core/AgentCLI.js +17 -14
  13. package/dist/agents/core/AgentCLI.js.map +1 -1
  14. package/dist/agents/core/BaseAgentAdapter.d.ts +10 -1
  15. package/dist/agents/core/BaseAgentAdapter.d.ts.map +1 -1
  16. package/dist/agents/core/BaseAgentAdapter.js +126 -3
  17. package/dist/agents/core/BaseAgentAdapter.js.map +1 -1
  18. package/dist/agents/core/types.d.ts +10 -0
  19. package/dist/agents/core/types.d.ts.map +1 -1
  20. package/dist/agents/plugins/claude/claude.plugin.d.ts +1 -8
  21. package/dist/agents/plugins/claude/claude.plugin.d.ts.map +1 -1
  22. package/dist/agents/plugins/claude/claude.plugin.js +95 -100
  23. package/dist/agents/plugins/claude/claude.plugin.js.map +1 -1
  24. package/dist/agents/plugins/claude/plugin/codemie-statusline.mjs +42 -0
  25. package/dist/agents/plugins/codemie-code-binary.d.ts +17 -0
  26. package/dist/agents/plugins/codemie-code-binary.d.ts.map +1 -0
  27. package/dist/agents/plugins/codemie-code-binary.js +94 -0
  28. package/dist/agents/plugins/codemie-code-binary.js.map +1 -0
  29. package/dist/agents/plugins/codemie-code.plugin.d.ts +53 -12
  30. package/dist/agents/plugins/codemie-code.plugin.d.ts.map +1 -1
  31. package/dist/agents/plugins/codemie-code.plugin.js +359 -147
  32. package/dist/agents/plugins/codemie-code.plugin.js.map +1 -1
  33. package/dist/agents/plugins/gemini/gemini.plugin.d.ts +8 -0
  34. package/dist/agents/plugins/gemini/gemini.plugin.d.ts.map +1 -1
  35. package/dist/agents/plugins/gemini/gemini.plugin.js +44 -0
  36. package/dist/agents/plugins/gemini/gemini.plugin.js.map +1 -1
  37. package/dist/agents/plugins/opencode/opencode-model-configs.d.ts +12 -2
  38. package/dist/agents/plugins/opencode/opencode-model-configs.d.ts.map +1 -1
  39. package/dist/agents/plugins/opencode/opencode-model-configs.js +240 -24
  40. package/dist/agents/plugins/opencode/opencode-model-configs.js.map +1 -1
  41. package/dist/agents/plugins/opencode/opencode.plugin.d.ts.map +1 -1
  42. package/dist/agents/plugins/opencode/opencode.plugin.js +62 -24
  43. package/dist/agents/plugins/opencode/opencode.plugin.js.map +1 -1
  44. package/dist/agents/registry.d.ts.map +1 -1
  45. package/dist/agents/registry.js +8 -7
  46. package/dist/agents/registry.js.map +1 -1
  47. package/dist/cli/commands/doctor/checks/AgentsCheck.d.ts.map +1 -1
  48. package/dist/cli/commands/doctor/checks/AgentsCheck.js +5 -2
  49. package/dist/cli/commands/doctor/checks/AgentsCheck.js.map +1 -1
  50. package/dist/cli/commands/doctor/checks/FrameworksCheck.d.ts.map +1 -1
  51. package/dist/cli/commands/doctor/checks/FrameworksCheck.js +5 -2
  52. package/dist/cli/commands/doctor/checks/FrameworksCheck.js.map +1 -1
  53. package/dist/cli/commands/doctor/index.d.ts.map +1 -1
  54. package/dist/cli/commands/doctor/index.js +87 -91
  55. package/dist/cli/commands/doctor/index.js.map +1 -1
  56. package/dist/cli/commands/hook.d.ts.map +1 -1
  57. package/dist/cli/commands/hook.js +23 -0
  58. package/dist/cli/commands/hook.js.map +1 -1
  59. package/dist/cli/commands/skill.d.ts.map +1 -1
  60. package/dist/cli/commands/skill.js +80 -1
  61. package/dist/cli/commands/skill.js.map +1 -1
  62. package/dist/cli/index.js +7 -13
  63. package/dist/cli/index.js.map +1 -1
  64. package/dist/providers/plugins/sso/sso.auth.d.ts +3 -1
  65. package/dist/providers/plugins/sso/sso.auth.d.ts.map +1 -1
  66. package/dist/providers/plugins/sso/sso.auth.js +70 -12
  67. package/dist/providers/plugins/sso/sso.auth.js.map +1 -1
  68. package/dist/utils/logger.d.ts +1 -0
  69. package/dist/utils/logger.d.ts.map +1 -1
  70. package/dist/utils/logger.js +16 -1
  71. package/dist/utils/logger.js.map +1 -1
  72. package/dist/utils/native-installer.d.ts.map +1 -1
  73. package/dist/utils/native-installer.js +35 -0
  74. package/dist/utils/native-installer.js.map +1 -1
  75. package/package.json +2 -1
@@ -0,0 +1,94 @@
1
+ import { existsSync } from 'fs';
2
+ import { join, dirname } from 'path';
3
+ import { fileURLToPath } from 'url';
4
+ import { logger } from '../../utils/logger.js';
5
+ /**
6
+ * Platform-specific package name mapping for @codemieai/codemie-opencode.
7
+ * The wrapper package lists these as optionalDependencies; npm only downloads
8
+ * the one matching the current platform.
9
+ */
10
+ export function getPlatformPackage() {
11
+ const platform = process.platform;
12
+ const arch = process.arch;
13
+ const platformMap = {
14
+ darwin: {
15
+ x64: '@codemieai/codemie-opencode-darwin-x64',
16
+ arm64: '@codemieai/codemie-opencode-darwin-arm64',
17
+ },
18
+ linux: {
19
+ x64: '@codemieai/codemie-opencode-linux-x64',
20
+ arm64: '@codemieai/codemie-opencode-linux-arm64',
21
+ },
22
+ win32: {
23
+ x64: '@codemieai/codemie-opencode-windows-x64',
24
+ arm64: '@codemieai/codemie-opencode-windows-arm64',
25
+ },
26
+ };
27
+ return platformMap[platform]?.[arch] ?? null;
28
+ }
29
+ /**
30
+ * Walk up from a starting directory looking for a node_modules directory
31
+ * that contains the given package.
32
+ */
33
+ function findPackageInNodeModules(startDir, packageName) {
34
+ let current = startDir;
35
+ while (true) {
36
+ const candidate = join(current, 'node_modules', packageName);
37
+ if (existsSync(candidate)) {
38
+ return candidate;
39
+ }
40
+ const parent = dirname(current);
41
+ if (parent === current)
42
+ break; // reached filesystem root
43
+ current = parent;
44
+ }
45
+ return null;
46
+ }
47
+ /**
48
+ * Resolve the bundled @codemieai/codemie-opencode binary from node_modules.
49
+ *
50
+ * Resolution order:
51
+ * 1. CODEMIE_OPENCODE_WL_BIN env var override (escape hatch)
52
+ * 2. Platform-specific binary from node_modules/@codemieai/codemie-opencode-{platform}-{arch}/bin/codemie
53
+ * 3. Wrapper package binary from node_modules/@codemieai/codemie-opencode/bin/codemie
54
+ * 4. Fallback: null (binary not found)
55
+ */
56
+ export function resolveCodemieOpenCodeBinary() {
57
+ // 1. Environment variable override
58
+ const envBin = process.env.CODEMIE_OPENCODE_WL_BIN;
59
+ if (envBin) {
60
+ if (existsSync(envBin)) {
61
+ logger.debug(`[codemie-code] Using binary from CODEMIE_OPENCODE_WL_BIN: ${envBin}`);
62
+ return envBin;
63
+ }
64
+ logger.warn(`[codemie-code] CODEMIE_OPENCODE_WL_BIN set but binary not found: ${envBin}`);
65
+ }
66
+ // Start searching from this module's directory
67
+ const moduleDir = dirname(fileURLToPath(import.meta.url));
68
+ const binName = process.platform === 'win32' ? 'codemie.exe' : 'codemie';
69
+ // 2. Try platform-specific package first (direct binary, no wrapper)
70
+ const platformPkg = getPlatformPackage();
71
+ if (platformPkg) {
72
+ const platformDir = findPackageInNodeModules(moduleDir, platformPkg);
73
+ if (platformDir) {
74
+ const platformBin = join(platformDir, 'bin', binName);
75
+ if (existsSync(platformBin)) {
76
+ logger.debug(`[codemie-code] Resolved platform binary: ${platformBin}`);
77
+ return platformBin;
78
+ }
79
+ }
80
+ }
81
+ // 3. Fall back to wrapper package binary
82
+ const wrapperDir = findPackageInNodeModules(moduleDir, '@codemieai/codemie-opencode');
83
+ if (wrapperDir) {
84
+ const wrapperBin = join(wrapperDir, 'bin', binName);
85
+ if (existsSync(wrapperBin)) {
86
+ logger.debug(`[codemie-code] Resolved wrapper binary: ${wrapperBin}`);
87
+ return wrapperBin;
88
+ }
89
+ }
90
+ // 4. Not found
91
+ logger.debug('[codemie-code] Binary not found in node_modules');
92
+ return null;
93
+ }
94
+ //# sourceMappingURL=codemie-code-binary.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"codemie-code-binary.js","sourceRoot":"","sources":["../../../src/agents/plugins/codemie-code-binary.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,UAAU,EAAE,MAAM,IAAI,CAAC;AAChC,OAAO,EAAE,IAAI,EAAE,OAAO,EAAE,MAAM,MAAM,CAAC;AACrC,OAAO,EAAE,aAAa,EAAE,MAAM,KAAK,CAAC;AACpC,OAAO,EAAE,MAAM,EAAE,MAAM,uBAAuB,CAAC;AAE/C;;;;GAIG;AACH,MAAM,UAAU,kBAAkB;IAChC,MAAM,QAAQ,GAAG,OAAO,CAAC,QAAQ,CAAC;IAClC,MAAM,IAAI,GAAG,OAAO,CAAC,IAAI,CAAC;IAE1B,MAAM,WAAW,GAA2C;QAC1D,MAAM,EAAE;YACN,GAAG,EAAE,wCAAwC;YAC7C,KAAK,EAAE,0CAA0C;SAClD;QACD,KAAK,EAAE;YACL,GAAG,EAAE,uCAAuC;YAC5C,KAAK,EAAE,yCAAyC;SACjD;QACD,KAAK,EAAE;YACL,GAAG,EAAE,yCAAyC;YAC9C,KAAK,EAAE,2CAA2C;SACnD;KACF,CAAC;IAEF,OAAO,WAAW,CAAC,QAAQ,CAAC,EAAE,CAAC,IAAI,CAAC,IAAI,IAAI,CAAC;AAC/C,CAAC;AAED;;;GAGG;AACH,SAAS,wBAAwB,CAAC,QAAgB,EAAE,WAAmB;IACrE,IAAI,OAAO,GAAG,QAAQ,CAAC;IAEvB,OAAO,IAAI,EAAE,CAAC;QACZ,MAAM,SAAS,GAAG,IAAI,CAAC,OAAO,EAAE,cAAc,EAAE,WAAW,CAAC,CAAC;QAC7D,IAAI,UAAU,CAAC,SAAS,CAAC,EAAE,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B,CAAC;QACH,CAAC;IACH,CAAC;IAED,yCAAyC;IACzC,MAAM,UAAU,GAAG,wBAAwB,CAAC,SAAS,EAAE,6BAA6B,CAAC,CAAC;IACtF,IAAI,UAAU,EAAE,CAAC;QACf,MAAM,UAAU,GAAG,IAAI,CAAC,UAAU,EAAE,KAAK,EAAE,OAAO,CAAC,CAAC;QACpD,IAAI,UAAU,CAAC,UAAU,CAAC,EAAE,CAAC;YAC3B,MAAM,CAAC,KAAK,CAAC,2CAA2C,UAAU,EAAE,CAAC,CAAC;YACtE,OAAO,UAAU,CAAC;QACpB,CAAC;IACH,CAAC;IAED,eAAe;IACf,MAAM,CAAC,KAAK,CAAC,iDAAiD,CAAC,CAAC;IAChE,OAAO,IAAI,CAAC;AACd,CAAC"}
@@ -1,25 +1,66 @@
1
- import { AgentMetadata, AgentAdapter } from '../core/types.js';
1
+ import type { AgentMetadata } from '../core/types.js';
2
+ import { BaseAgentAdapter } from '../core/BaseAgentAdapter.js';
3
+ import type { SessionAdapter } from '../core/session/BaseSessionAdapter.js';
4
+ import type { BaseExtensionInstaller } from '../core/extension/BaseExtensionInstaller.js';
2
5
  /**
3
6
  * Built-in agent name constant - single source of truth
4
7
  */
5
8
  export declare const BUILTIN_AGENT_NAME = "codemie-code";
6
9
  /**
7
- * CodeMie-Code Plugin Metadata
10
+ * Environment variable contract between the umbrella CLI and whitelabel binary.
11
+ *
12
+ * The umbrella CLI orchestrates everything (proxy, auth, metrics, session sync)
13
+ * and spawns the whitelabel binary as a child process. The whitelabel knows
14
+ * nothing about SSO, cookies, or metrics — it just sees an OpenAI-compatible
15
+ * endpoint at localhost.
16
+ *
17
+ * Flow: BaseAgentAdapter.run() → setupProxy() → beforeRun hook → spawn(binary)
18
+ *
19
+ * | Env Var | Set By | Consumed By | Purpose |
20
+ * |--------------------------|----------------------|----------------------|------------------------------------------------|
21
+ * | OPENCODE_CONFIG_CONTENT | beforeRun hook | Whitelabel config.ts | Full provider config JSON (proxy URL, models) |
22
+ * | OPENCODE_CONFIG | beforeRun (fallback) | Whitelabel config.ts | Temp file path when JSON exceeds env var limit |
23
+ * | OPENCODE_DISABLE_SHARE | beforeRun hook | Whitelabel | Disables share functionality |
24
+ * | CODEMIE_SESSION_ID | BaseAgentAdapter | onSessionEnd hook | Session ID for metrics correlation |
25
+ * | CODEMIE_AGENT | BaseAgentAdapter | Lifecycle helpers | Agent name ('codemie-code') |
26
+ * | CODEMIE_PROVIDER | Config loader | setupProxy() | Provider name (e.g., 'ai-run-sso') |
27
+ * | CODEMIE_BASE_URL | setupProxy() | beforeRun hook | Proxy URL (http://localhost:{port}) |
28
+ * | CODEMIE_MODEL | Config/CLI | beforeRun hook | Selected model ID |
29
+ * | CODEMIE_PROJECT | SSO exportEnvVars | Session metadata | CodeMie project name |
8
30
  */
9
31
  export declare const CodeMieCodePluginMetadata: AgentMetadata;
10
32
  /**
11
- * CodeMie-Code Adapter
12
- * Custom implementation for built-in agent
33
+ * CodeMie Code Plugin
34
+ * Wraps the @codemieai/codemie-opencode binary as the built-in agent
13
35
  */
14
- export declare class CodeMieCodePlugin implements AgentAdapter {
15
- name: string;
16
- displayName: string;
17
- description: string;
36
+ export declare class CodeMieCodePlugin extends BaseAgentAdapter {
37
+ private sessionAdapter;
38
+ constructor();
39
+ /**
40
+ * Check if the whitelabel binary is available.
41
+ * Uses existsSync on the resolved binary path instead of PATH lookup.
42
+ */
43
+ isInstalled(): Promise<boolean>;
44
+ /**
45
+ * Install the whitelabel package globally.
46
+ */
18
47
  install(): Promise<void>;
48
+ /**
49
+ * Uninstall the whitelabel package and its platform-specific binary.
50
+ *
51
+ * npm hoists the platform-specific binary package (e.g.
52
+ * @codemieai/codemie-opencode-darwin-arm64) to the top-level global
53
+ * node_modules. `npm uninstall -g @codemieai/codemie-opencode` only removes
54
+ * the wrapper, leaving the binary as an orphan. We explicitly remove both.
55
+ */
19
56
  uninstall(): Promise<void>;
20
- isInstalled(): Promise<boolean>;
21
- run(args: string[], envOverrides?: Record<string, string>): Promise<void>;
22
- getVersion(): Promise<string | null>;
23
- getMetricsConfig(): import('../core/types.js').AgentMetricsConfig | undefined;
57
+ /**
58
+ * Return session adapter for analytics.
59
+ */
60
+ getSessionAdapter(): SessionAdapter;
61
+ /**
62
+ * No extension installer needed.
63
+ */
64
+ getExtensionInstaller(): BaseExtensionInstaller | undefined;
24
65
  }
25
66
  //# sourceMappingURL=codemie-code.plugin.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"codemie-code.plugin.d.ts","sourceRoot":"","sources":["../../../src/agents/plugins/codemie-code.plugin.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,aAAa,EAAE,YAAY,EAAE,MAAM,kBAAkB,CAAC;AAW/D;;GAEG;AACH,eAAO,MAAM,kBAAkB,iBAAiB,CAAC;AAEjD;;GAEG;AACH,eAAO,MAAM,yBAAyB,EAAE,aA4GvC,CAAC;AAEF;;;GAGG;AACH,qBAAa,iBAAkB,YAAW,YAAY;IACpD,IAAI,SAAsB;IAC1B,WAAW,SAAoB;IAC/B,WAAW,SAAsE;IAE3E,OAAO,IAAI,OAAO,CAAC,IAAI,CAAC;IAIxB,SAAS,IAAI,OAAO,CAAC,IAAI,CAAC;IAI1B,WAAW,IAAI,OAAO,CAAC,OAAO,CAAC;IAI/B,GAAG,CAAC,IAAI,EAAE,MAAM,EAAE,EAAE,YAAY,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,GAAG,OAAO,CAAC,IAAI,CAAC;IAmCzE,UAAU,IAAI,OAAO,CAAC,MAAM,GAAG,IAAI,CAAC;IAW1C,gBAAgB,IAAI,OAAO,kBAAkB,EAAE,kBAAkB,GAAG,SAAS;CAI9E"}
1
+ {"version":3,"file":"codemie-code.plugin.d.ts","sourceRoot":"","sources":["../../../src/agents/plugins/codemie-code.plugin.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,aAAa,EAAe,MAAM,kBAAkB,CAAC;AAMnE,OAAO,EAAE,gBAAgB,EAAE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