@openchamber/web 1.9.0 → 1.9.1

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/dist/index.html CHANGED
@@ -439,10 +439,10 @@
439
439
  pointer-events: none;
440
440
  }
441
441
  </style>
442
- <script type="module" crossorigin src="/assets/index-DwBYZzfk.js"></script>
443
- <link rel="modulepreload" crossorigin href="/assets/vendor-.bun-CFSqfaPx.js">
442
+ <script type="module" crossorigin src="/assets/index-DxSaS6H8.js"></script>
443
+ <link rel="modulepreload" crossorigin href="/assets/vendor-.bun-CbwevZxt.js">
444
444
  <link rel="stylesheet" crossorigin href="/assets/vendor--DbVqbJpV.css">
445
- <link rel="stylesheet" crossorigin href="/assets/index-D11fl8SZ.css">
445
+ <link rel="stylesheet" crossorigin href="/assets/index-iJAr-2Bc.css">
446
446
  </head>
447
447
  <body class="h-full bg-background text-foreground">
448
448
  <div id="root" class="h-full">
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@openchamber/web",
3
- "version": "1.9.0",
3
+ "version": "1.9.1",
4
4
  "private": false,
5
5
  "type": "module",
6
6
  "main": "./server/index.js",
@@ -237,10 +237,18 @@ const createGit = async (directory) => {
237
237
  const env = await buildGitEnv();
238
238
  const spawnOptions = { windowsHide: true };
239
239
  const binary = getGitBinary();
240
+ const hasCustomBinary = typeof binary === 'string' && binary.trim() && binary !== 'git' && binary !== 'git.exe';
241
+ const unsafe = hasCustomBinary ? { allowUnsafeCustomBinary: true } : undefined;
240
242
  if (!directory) {
241
- return simpleGit({ env, spawnOptions, binary });
242
- }
243
- return simpleGit({ baseDir: normalizeDirectoryPath(directory), env, spawnOptions, binary });
243
+ return simpleGit({ env, spawnOptions, binary, unsafe });
244
+ }
245
+ return simpleGit({
246
+ baseDir: normalizeDirectoryPath(directory),
247
+ env,
248
+ spawnOptions,
249
+ binary,
250
+ unsafe,
251
+ });
244
252
  };
245
253
 
246
254
  const normalizeDirectoryPath = (value) => {
@@ -240,9 +240,6 @@ function getJsonWriteTarget(layers, preferredScope) {
240
240
  if (preferredScope === AGENT_SCOPE.PROJECT && paths.projectPath) {
241
241
  return { config: projectConfig, path: paths.projectPath };
242
242
  }
243
- if (paths.projectPath) {
244
- return { config: projectConfig, path: paths.projectPath };
245
- }
246
243
  return { config: userConfig, path: paths.userPath };
247
244
  }
248
245
 
@@ -1,131 +1,15 @@
1
1
  // MiniMax Coding Plan Provider
2
- import { readAuthFile } from '../../opencode/auth.js';
3
- import {
4
- getAuthEntry,
5
- normalizeAuthEntry,
6
- buildResult,
7
- toUsageWindow,
8
- toNumber,
9
- toTimestamp,
10
- } from '../utils/index.js';
11
-
12
- export const providerId = 'minimax-cn-coding-plan';
13
- export const providerName = 'MiniMax Coding Plan (minimaxi.com)';
14
- export const aliases = ['minimax-cn-coding-plan'];
15
-
16
- export const isConfigured = () => {
17
- const auth = readAuthFile();
18
- const entry = normalizeAuthEntry(getAuthEntry(auth, aliases));
19
- return Boolean(entry?.key || entry?.token);
20
- };
21
-
22
- export const fetchQuota = async () => {
23
- const auth = readAuthFile();
24
- const entry = normalizeAuthEntry(getAuthEntry(auth, aliases));
25
- const apiKey = entry?.key ?? entry?.token;
26
-
27
- if (!apiKey) {
28
- return buildResult({
29
- providerId,
30
- providerName,
31
- ok: false,
32
- configured: false,
33
- error: 'Not configured',
34
- });
35
- }
36
-
37
- try {
38
- const response = await fetch(
39
- 'https://www.minimaxi.com/v1/api/openplatform/coding_plan/remains',
40
- {
41
- method: 'GET',
42
- headers: {
43
- Authorization: `Bearer ${apiKey}`,
44
- 'Content-Type': 'application/json',
45
- },
46
- },
47
- );
48
-
49
- if (!response.ok) {
50
- return buildResult({
51
- providerId,
52
- providerName,
53
- ok: false,
54
- configured: true,
55
- error: `API error: ${response.status}`,
56
- });
57
- }
58
-
59
- const payload = await response.json();
60
-
61
- const baseResp = payload?.base_resp;
62
- if (baseResp && baseResp.status_code !== 0) {
63
- return buildResult({
64
- providerId,
65
- providerName,
66
- ok: false,
67
- configured: true,
68
- error: baseResp.status_msg || `API error: ${baseResp.status_code}`,
69
- });
70
- }
71
-
72
- const windows = {};
73
- const modelRemains = payload?.model_remains;
74
-
75
- if (Array.isArray(modelRemains) && modelRemains.length > 0) {
76
- const firstModel = modelRemains[0];
77
- const total = toNumber(firstModel?.current_interval_total_count);
78
- const used = 600 - toNumber(firstModel?.current_interval_usage_count);
79
-
80
- if (total === null || used === null) {
81
- return buildResult({
82
- providerId,
83
- providerName,
84
- ok: false,
85
- configured: true,
86
- error: 'Missing required quota fields',
87
- });
88
- }
89
-
90
- const usedPercent =
91
- total > 0 ? Math.max(0, Math.min(100, (used / total) * 100)) : null;
92
-
93
- const startTime = toTimestamp(firstModel?.start_time);
94
- const endTime = toTimestamp(firstModel?.end_time);
95
- const windowSeconds =
96
- startTime && endTime && endTime > startTime
97
- ? Math.floor((endTime - startTime) / 1000)
98
- : null;
99
-
100
- windows['5h'] = toUsageWindow({
101
- usedPercent,
102
- windowSeconds,
103
- resetAt: endTime,
104
- });
105
- } else {
106
- return buildResult({
107
- providerId,
108
- providerName,
109
- ok: false,
110
- configured: true,
111
- error: 'No model quota data available',
112
- });
113
- }
114
-
115
- return buildResult({
116
- providerId,
117
- providerName,
118
- ok: true,
119
- configured: true,
120
- usage: { windows },
121
- });
122
- } catch (error) {
123
- return buildResult({
124
- providerId,
125
- providerName,
126
- ok: false,
127
- configured: true,
128
- error: error instanceof Error ? error.message : 'Request failed',
129
- });
130
- }
131
- };
2
+ import { createMiniMaxCodingPlanProvider } from './minimax-shared.js';
3
+
4
+ const provider = createMiniMaxCodingPlanProvider({
5
+ providerId: 'minimax-cn-coding-plan',
6
+ providerName: 'MiniMax Coding Plan (minimaxi.com)',
7
+ aliases: ['minimax-cn-coding-plan'],
8
+ endpoint: 'https://www.minimaxi.com/v1/api/openplatform/coding_plan/remains',
9
+ });
10
+
11
+ export const providerId = provider.providerId;
12
+ export const providerName = provider.providerName;
13
+ export const aliases = provider.aliases;
14
+ export const isConfigured = provider.isConfigured;
15
+ export const fetchQuota = provider.fetchQuota;
@@ -1,131 +1,15 @@
1
1
  // MiniMax Coding Plan Provider
2
- import { readAuthFile } from '../../opencode/auth.js';
3
- import {
4
- getAuthEntry,
5
- normalizeAuthEntry,
6
- buildResult,
7
- toUsageWindow,
8
- toNumber,
9
- toTimestamp,
10
- } from '../utils/index.js';
11
-
12
- export const providerId = 'minimax-coding-plan';
13
- export const providerName = 'MiniMax Coding Plan (minimax.io)';
14
- export const aliases = ['minimax-coding-plan'];
15
-
16
- export const isConfigured = () => {
17
- const auth = readAuthFile();
18
- const entry = normalizeAuthEntry(getAuthEntry(auth, aliases));
19
- return Boolean(entry?.key || entry?.token);
20
- };
21
-
22
- export const fetchQuota = async () => {
23
- const auth = readAuthFile();
24
- const entry = normalizeAuthEntry(getAuthEntry(auth, aliases));
25
- const apiKey = entry?.key ?? entry?.token;
26
-
27
- if (!apiKey) {
28
- return buildResult({
29
- providerId,
30
- providerName,
31
- ok: false,
32
- configured: false,
33
- error: 'Not configured',
34
- });
35
- }
36
-
37
- try {
38
- const response = await fetch(
39
- 'https://www.minimax.io/v1/api/openplatform/coding_plan/remains',
40
- {
41
- method: 'GET',
42
- headers: {
43
- Authorization: `Bearer ${apiKey}`,
44
- 'Content-Type': 'application/json',
45
- },
46
- },
47
- );
48
-
49
- if (!response.ok) {
50
- return buildResult({
51
- providerId,
52
- providerName,
53
- ok: false,
54
- configured: true,
55
- error: `API error: ${response.status}`,
56
- });
57
- }
58
-
59
- const payload = await response.json();
60
-
61
- const baseResp = payload?.base_resp;
62
- if (baseResp && baseResp.status_code !== 0) {
63
- return buildResult({
64
- providerId,
65
- providerName,
66
- ok: false,
67
- configured: true,
68
- error: baseResp.status_msg || `API error: ${baseResp.status_code}`,
69
- });
70
- }
71
-
72
- const windows = {};
73
- const modelRemains = payload?.model_remains;
74
-
75
- if (Array.isArray(modelRemains) && modelRemains.length > 0) {
76
- const firstModel = modelRemains[0];
77
- const total = toNumber(firstModel?.current_interval_total_count);
78
- const used = 600-toNumber(firstModel?.current_interval_usage_count);
79
-
80
- if (total === null || used === null) {
81
- return buildResult({
82
- providerId,
83
- providerName,
84
- ok: false,
85
- configured: true,
86
- error: 'Missing required quota fields',
87
- });
88
- }
89
-
90
- const usedPercent =
91
- total > 0 ? Math.max(0, Math.min(100, (used / total) * 100)) : null;
92
-
93
- const startTime = toTimestamp(firstModel?.start_time);
94
- const endTime = toTimestamp(firstModel?.end_time);
95
- const windowSeconds =
96
- startTime && endTime && endTime > startTime
97
- ? Math.floor((endTime - startTime) / 1000)
98
- : null;
99
-
100
- windows['5h'] = toUsageWindow({
101
- usedPercent,
102
- windowSeconds,
103
- resetAt: endTime,
104
- });
105
- } else {
106
- return buildResult({
107
- providerId,
108
- providerName,
109
- ok: false,
110
- configured: true,
111
- error: 'No model quota data available',
112
- });
113
- }
114
-
115
- return buildResult({
116
- providerId,
117
- providerName,
118
- ok: true,
119
- configured: true,
120
- usage: { windows },
121
- });
122
- } catch (error) {
123
- return buildResult({
124
- providerId,
125
- providerName,
126
- ok: false,
127
- configured: true,
128
- error: error instanceof Error ? error.message : 'Request failed',
129
- });
130
- }
131
- };
2
+ import { createMiniMaxCodingPlanProvider } from './minimax-shared.js';
3
+
4
+ const provider = createMiniMaxCodingPlanProvider({
5
+ providerId: 'minimax-coding-plan',
6
+ providerName: 'MiniMax Coding Plan (minimax.io)',
7
+ aliases: ['minimax-coding-plan'],
8
+ endpoint: 'https://www.minimax.io/v1/api/openplatform/coding_plan/remains',
9
+ });
10
+
11
+ export const providerId = provider.providerId;
12
+ export const providerName = provider.providerName;
13
+ export const aliases = provider.aliases;
14
+ export const isConfigured = provider.isConfigured;
15
+ export const fetchQuota = provider.fetchQuota;
@@ -0,0 +1,136 @@
1
+ import { readAuthFile } from '../../opencode/auth.js';
2
+ import {
3
+ getAuthEntry,
4
+ normalizeAuthEntry,
5
+ buildResult,
6
+ toUsageWindow,
7
+ toNumber,
8
+ toTimestamp,
9
+ } from '../utils/index.js';
10
+
11
+ export const createMiniMaxCodingPlanProvider = ({ providerId, providerName, aliases, endpoint }) => {
12
+ const isConfigured = () => {
13
+ const auth = readAuthFile();
14
+ const entry = normalizeAuthEntry(getAuthEntry(auth, aliases));
15
+ return Boolean(entry?.key || entry?.token);
16
+ };
17
+
18
+ const fetchQuota = async () => {
19
+ const auth = readAuthFile();
20
+ const entry = normalizeAuthEntry(getAuthEntry(auth, aliases));
21
+ const apiKey = entry?.key ?? entry?.token;
22
+
23
+ if (!apiKey) {
24
+ return buildResult({
25
+ providerId,
26
+ providerName,
27
+ ok: false,
28
+ configured: false,
29
+ error: 'Not configured',
30
+ });
31
+ }
32
+
33
+ try {
34
+ const response = await fetch(endpoint, {
35
+ method: 'GET',
36
+ headers: {
37
+ Authorization: `Bearer ${apiKey}`,
38
+ 'Content-Type': 'application/json',
39
+ },
40
+ });
41
+
42
+ if (!response.ok) {
43
+ return buildResult({
44
+ providerId,
45
+ providerName,
46
+ ok: false,
47
+ configured: true,
48
+ error: `API error: ${response.status}`,
49
+ });
50
+ }
51
+
52
+ const payload = await response.json();
53
+ const baseResp = payload?.base_resp;
54
+ if (baseResp && baseResp.status_code !== 0) {
55
+ return buildResult({
56
+ providerId,
57
+ providerName,
58
+ ok: false,
59
+ configured: true,
60
+ error: baseResp.status_msg || `API error: ${baseResp.status_code}`,
61
+ });
62
+ }
63
+
64
+ const firstModel = payload?.model_remains?.[0];
65
+ if (!firstModel) {
66
+ return buildResult({
67
+ providerId,
68
+ providerName,
69
+ ok: false,
70
+ configured: true,
71
+ error: 'No model quota data available',
72
+ });
73
+ }
74
+
75
+ const intervalTotal = toNumber(firstModel.current_interval_total_count);
76
+ const intervalUsage = toNumber(firstModel.current_interval_usage_count);
77
+ const intervalStartAt = toTimestamp(firstModel.start_time);
78
+ const intervalResetAt = toTimestamp(firstModel.end_time);
79
+ const weeklyTotal = toNumber(firstModel.current_weekly_total_count);
80
+ const weeklyUsage = toNumber(firstModel.current_weekly_usage_count);
81
+ const weeklyStartAt = toTimestamp(firstModel.weekly_start_time);
82
+ const weeklyResetAt = toTimestamp(firstModel.weekly_end_time);
83
+ const intervalUsed = intervalTotal - intervalUsage;
84
+ const weeklyUsed = weeklyTotal - weeklyUsage;
85
+ const intervalUsedPercent =
86
+ intervalTotal > 0 ? Math.max(0, Math.min(100, (intervalUsed / intervalTotal) * 100)) : null;
87
+ const intervalWindowSeconds =
88
+ intervalStartAt && intervalResetAt && intervalResetAt > intervalStartAt
89
+ ? Math.floor((intervalResetAt - intervalStartAt) / 1000)
90
+ : null;
91
+ const weeklyUsedPercent =
92
+ weeklyTotal > 0 ? Math.max(0, Math.min(100, (weeklyUsed / weeklyTotal) * 100)) : null;
93
+ const weeklyWindowSeconds =
94
+ weeklyStartAt && weeklyResetAt && weeklyResetAt > weeklyStartAt
95
+ ? Math.floor((weeklyResetAt - weeklyStartAt) / 1000)
96
+ : null;
97
+
98
+ const windows = {
99
+ '5h': toUsageWindow({
100
+ usedPercent: intervalUsedPercent,
101
+ windowSeconds: intervalWindowSeconds,
102
+ resetAt: intervalResetAt,
103
+ }),
104
+ weekly: toUsageWindow({
105
+ usedPercent: weeklyUsedPercent,
106
+ windowSeconds: weeklyWindowSeconds,
107
+ resetAt: weeklyResetAt,
108
+ }),
109
+ };
110
+
111
+ return buildResult({
112
+ providerId,
113
+ providerName,
114
+ ok: true,
115
+ configured: true,
116
+ usage: { windows },
117
+ });
118
+ } catch (error) {
119
+ return buildResult({
120
+ providerId,
121
+ providerName,
122
+ ok: false,
123
+ configured: true,
124
+ error: error instanceof Error ? error.message : 'Request failed',
125
+ });
126
+ }
127
+ };
128
+
129
+ return {
130
+ providerId,
131
+ providerName,
132
+ aliases,
133
+ isConfigured,
134
+ fetchQuota,
135
+ };
136
+ };