@kosuke-ai/cli 5.14.0 → 5.15.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.
@@ -85,9 +85,9 @@ const obj = (value) => value && typeof value === 'object' && !Array.isArray(valu
85
85
  function dataOf(result) {
86
86
  return result.response.ok ? obj(obj(result.data)?.data) : null;
87
87
  }
88
- /** `session 42%, week 61%`, with only the windows the provider reported. */
88
+ /** `session 42%, week 61%` or `session 42%, month 12%`, with only the windows the provider reported. */
89
89
  function usageWords(usage) {
90
- const windows = ['session', 'week'].flatMap((name) => {
90
+ const windows = ['session', 'week', 'month'].flatMap((name) => {
91
91
  const utilization = obj(usage?.[name])?.utilization;
92
92
  return typeof utilization === 'number' && Number.isFinite(utilization)
93
93
  ? [`${name} ${Math.round(utilization)}% used`]
@@ -99,11 +99,13 @@ const SUBSCRIPTIONS = [
99
99
  { key: 'anthropic', label: 'Your Claude subscription', usage: 'claude_code' },
100
100
  { key: 'openai', label: 'Your Codex subscription', usage: 'codex' },
101
101
  { key: 'zai', label: 'Your GLM Coding Plan', usage: 'coding_plan' },
102
+ { key: 'moonshot', label: 'Your Kimi Code', usage: 'kimi_code' },
102
103
  ];
103
104
  const WORKSPACE_PROVIDERS = [
104
105
  { key: 'anthropic', name: 'Anthropic' },
105
106
  { key: 'openai', name: 'OpenAI' },
106
107
  { key: 'zai', name: 'Z.ai' },
108
+ { key: 'moonshot', name: 'Moonshot AI' },
107
109
  ];
108
110
  const AUTH_METHOD_NAMES = {
109
111
  api_key: 'API key',
@@ -111,8 +113,9 @@ const AUTH_METHOD_NAMES = {
111
113
  claude_code: 'Claude login',
112
114
  codex: 'Codex login',
113
115
  coding_plan: 'GLM Coding Plan',
116
+ kimi_code: 'Kimi Code',
114
117
  };
115
- const USAGE_PLANS = ['claude_code', 'codex', 'coding_plan'];
118
+ const USAGE_PLANS = ['claude_code', 'codex', 'coding_plan', 'kimi_code'];
116
119
  function subscriptionEntries(subscriptions) {
117
120
  return SUBSCRIPTIONS.flatMap(({ key, label, usage }) => {
118
121
  const row = obj(subscriptions[key]);
@@ -177,6 +180,7 @@ async function fetchProviders(client, workspace, signal) {
177
180
  claude_code: '/api/organizations/{workspaceId}/ai-provider/claude-usage',
178
181
  codex: '/api/organizations/{workspaceId}/ai-provider/codex-usage',
179
182
  coding_plan: '/api/organizations/{workspaceId}/ai-provider/coding-plan-usage',
183
+ kimi_code: '/api/organizations/{workspaceId}/ai-provider/kimi-code-usage',
180
184
  };
181
185
  const shared = (settings ? workspaceEntries(settings) : []).map((entry) => ({
182
186
  entry,
@@ -135,35 +135,36 @@ import { operation as o133 } from './workspaces/ai-provider-set.js';
135
135
  import { operation as o134 } from './workspaces/ai-provider-usage-claude.js';
136
136
  import { operation as o135 } from './workspaces/ai-provider-usage-codex.js';
137
137
  import { operation as o136 } from './workspaces/ai-provider-usage-coding-plan.js';
138
- import { operation as o137 } from './workspaces/artifacts.js';
139
- import { operation as o138 } from './workspaces/credits.js';
140
- import { operation as o139 } from './workspaces/get.js';
141
- import { operation as o140 } from './workspaces/getting-started-get.js';
142
- import { operation as o141 } from './workspaces/getting-started-update.js';
143
- import { operation as o142 } from './workspaces/integrations-sentry-get.js';
144
- import { operation as o143 } from './workspaces/integrations-sentry-remove.js';
145
- import { operation as o144 } from './workspaces/integrations-slack-get.js';
146
- import { operation as o145 } from './workspaces/lead-cards.js';
147
- import { operation as o146 } from './workspaces/lead-merge.js';
148
- import { operation as o147 } from './workspaces/lead-notifications-open.js';
149
- import { operation as o148 } from './workspaces/lead-proposals-create.js';
150
- import { operation as o149 } from './workspaces/lead-triage.js';
151
- import { operation as o150 } from './workspaces/list.js';
152
- import { operation as o151 } from './workspaces/members.js';
153
- import { operation as o152 } from './workspaces/plugins-list.js';
154
- import { operation as o153 } from './workspaces/plugins-update.js';
155
- import { operation as o154 } from './workspaces/provider-login-claude-complete.js';
156
- import { operation as o155 } from './workspaces/provider-login-claude-start.js';
157
- import { operation as o156 } from './workspaces/provider-login-codex-complete.js';
158
- import { operation as o157 } from './workspaces/provider-login-codex-start.js';
159
- import { operation as o158 } from './workspaces/sandbox-limit.js';
160
- import { operation as o159 } from './workspaces/skills-create.js';
161
- import { operation as o160 } from './workspaces/skills-delete.js';
162
- import { operation as o161 } from './workspaces/skills-get.js';
163
- import { operation as o162 } from './workspaces/skills-list.js';
164
- import { operation as o163 } from './workspaces/skills-update.js';
165
- import { operation as o164 } from './workspaces/stop-sandboxes.js';
166
- import { operation as o165 } from './workspaces/usage.js';
138
+ import { operation as o137 } from './workspaces/ai-provider-usage-kimi-code.js';
139
+ import { operation as o138 } from './workspaces/artifacts.js';
140
+ import { operation as o139 } from './workspaces/credits.js';
141
+ import { operation as o140 } from './workspaces/get.js';
142
+ import { operation as o141 } from './workspaces/getting-started-get.js';
143
+ import { operation as o142 } from './workspaces/getting-started-update.js';
144
+ import { operation as o143 } from './workspaces/integrations-sentry-get.js';
145
+ import { operation as o144 } from './workspaces/integrations-sentry-remove.js';
146
+ import { operation as o145 } from './workspaces/integrations-slack-get.js';
147
+ import { operation as o146 } from './workspaces/lead-cards.js';
148
+ import { operation as o147 } from './workspaces/lead-merge.js';
149
+ import { operation as o148 } from './workspaces/lead-notifications-open.js';
150
+ import { operation as o149 } from './workspaces/lead-proposals-create.js';
151
+ import { operation as o150 } from './workspaces/lead-triage.js';
152
+ import { operation as o151 } from './workspaces/list.js';
153
+ import { operation as o152 } from './workspaces/members.js';
154
+ import { operation as o153 } from './workspaces/plugins-list.js';
155
+ import { operation as o154 } from './workspaces/plugins-update.js';
156
+ import { operation as o155 } from './workspaces/provider-login-claude-complete.js';
157
+ import { operation as o156 } from './workspaces/provider-login-claude-start.js';
158
+ import { operation as o157 } from './workspaces/provider-login-codex-complete.js';
159
+ import { operation as o158 } from './workspaces/provider-login-codex-start.js';
160
+ import { operation as o159 } from './workspaces/sandbox-limit.js';
161
+ import { operation as o160 } from './workspaces/skills-create.js';
162
+ import { operation as o161 } from './workspaces/skills-delete.js';
163
+ import { operation as o162 } from './workspaces/skills-get.js';
164
+ import { operation as o163 } from './workspaces/skills-list.js';
165
+ import { operation as o164 } from './workspaces/skills-update.js';
166
+ import { operation as o165 } from './workspaces/stop-sandboxes.js';
167
+ import { operation as o166 } from './workspaces/usage.js';
167
168
  export const operations = [
168
169
  o0,
169
170
  o1,
@@ -331,4 +332,5 @@ export const operations = [
331
332
  o163,
332
333
  o164,
333
334
  o165,
335
+ o166,
334
336
  ];
@@ -6,7 +6,7 @@ export const operation = {
6
6
  "subscriptions",
7
7
  "delete"
8
8
  ],
9
- "summary": "Disconnect your subscription for one provider, anthropic, openai or zai, and release the sandboxes running on it. Answers 204.",
9
+ "summary": "Disconnect your subscription for one provider, anthropic, openai, zai or moonshot, and release the sandboxes running on it. Answers 204.",
10
10
  "pathParams": [
11
11
  "provider"
12
12
  ],
@@ -6,7 +6,7 @@ export const operation = {
6
6
  "subscriptions",
7
7
  "get"
8
8
  ],
9
- "summary": "Read your Claude, Codex and GLM Coding Plan subscriptions (connected, needsReauth, accountEmail) and your default model.",
9
+ "summary": "Read your Claude, Codex, GLM Coding Plan and Kimi Code subscriptions (connected, needsReauth, accountEmail, and maskedApiKey for a pasted plan key) and your default model.",
10
10
  "pathParams": [],
11
11
  "query": [],
12
12
  "body": null,
@@ -6,7 +6,7 @@ export const operation = {
6
6
  "subscriptions",
7
7
  "set-key"
8
8
  ],
9
- "summary": "Connect your GLM Coding Plan by its API key, zai only: Claude and Codex connect by signing in. The key is tested with one call before it is kept.",
9
+ "summary": "Connect your GLM Coding Plan (zai) or Kimi Code (moonshot) by its API key: Claude and Codex connect by signing in. The key is tested with one call before it is kept.",
10
10
  "pathParams": [
11
11
  "provider"
12
12
  ],
@@ -6,7 +6,7 @@ export const operation = {
6
6
  "subscriptions",
7
7
  "usage"
8
8
  ],
9
- "summary": "Read the session and weekly utilization of your Claude (claude_code, the default), Codex or GLM Coding Plan (coding_plan) subscription. 400 when it is not connected or needs reconnecting.",
9
+ "summary": "Read the session and weekly utilization of your Claude (claude_code, the default), Codex, GLM Coding Plan (coding_plan) or Kimi Code (kimi_code) subscription; Kimi Code reports a monthly window instead of a weekly one. 400 when it is not connected or needs reconnecting.",
10
10
  "pathParams": [],
11
11
  "query": [
12
12
  {
@@ -17,7 +17,8 @@ export const operation = {
17
17
  "choices": [
18
18
  "claude_code",
19
19
  "codex",
20
- "coding_plan"
20
+ "coding_plan",
21
+ "kimi_code"
21
22
  ]
22
23
  }
23
24
  ],
@@ -19,7 +19,8 @@ export const operation = {
19
19
  "choices": [
20
20
  "anthropic",
21
21
  "openai",
22
- "zai"
22
+ "zai",
23
+ "moonshot"
23
24
  ]
24
25
  },
25
26
  {
@@ -27,13 +28,14 @@ export const operation = {
27
28
  "flag": "auth-method",
28
29
  "kind": "string",
29
30
  "required": true,
30
- "description": "Must belong to the provider: anthropic takes api_key, aws_bedrock or claude_code, openai api_key or codex, zai coding_plan.",
31
+ "description": "Must belong to the provider: anthropic takes api_key, aws_bedrock or claude_code, openai api_key or codex, zai coding_plan, moonshot kimi_code.",
31
32
  "choices": [
32
33
  "api_key",
33
34
  "aws_bedrock",
34
35
  "claude_code",
35
36
  "codex",
36
- "coding_plan"
37
+ "coding_plan",
38
+ "kimi_code"
37
39
  ]
38
40
  }
39
41
  ],
@@ -0,0 +1,23 @@
1
+ export const operation = {
2
+ "method": "get",
3
+ "path": "/api/organizations/{workspaceId}/ai-provider/kimi-code-usage",
4
+ "command": [
5
+ "workspaces",
6
+ "ai-provider",
7
+ "usage",
8
+ "kimi-code"
9
+ ],
10
+ "summary": "Read the session and monthly utilization of the workspace's Kimi Code. 400 when the workspace holds no Kimi Code key.",
11
+ "pathParams": [
12
+ "workspaceId"
13
+ ],
14
+ "query": [],
15
+ "body": null,
16
+ "multipart": null,
17
+ "attachments": false,
18
+ "anonymous": false,
19
+ "sandboxToken": true,
20
+ "orchestratorToken": true,
21
+ "cronToken": true,
22
+ "leadToken": true
23
+ };
package/openapi.json CHANGED
@@ -880,6 +880,20 @@
880
880
  }
881
881
  },
882
882
  "required": ["operation"]
883
+ },
884
+ {
885
+ "type": "object",
886
+ "properties": {
887
+ "operation": {
888
+ "type": "string",
889
+ "const": "moonshot_kimi_code"
890
+ },
891
+ "kimiCodeKey": {
892
+ "type": "string",
893
+ "minLength": 1
894
+ }
895
+ },
896
+ "required": ["operation"]
883
897
  }
884
898
  ]
885
899
  }
@@ -940,18 +954,25 @@
940
954
  "required": true,
941
955
  "schema": {
942
956
  "type": "string",
943
- "enum": ["anthropic", "openai", "zai"]
957
+ "enum": ["anthropic", "openai", "zai", "moonshot"]
944
958
  }
945
959
  },
946
960
  {
947
961
  "name": "authMethod",
948
962
  "in": "query",
949
963
  "required": true,
950
- "description": "Must belong to the provider: anthropic takes api_key, aws_bedrock or claude_code, openai api_key or codex, zai coding_plan.",
964
+ "description": "Must belong to the provider: anthropic takes api_key, aws_bedrock or claude_code, openai api_key or codex, zai coding_plan, moonshot kimi_code.",
951
965
  "schema": {
952
966
  "type": "string",
953
- "enum": ["api_key", "aws_bedrock", "claude_code", "codex", "coding_plan"],
954
- "description": "Must belong to the provider: anthropic takes api_key, aws_bedrock or claude_code, openai api_key or codex, zai coding_plan."
967
+ "enum": [
968
+ "api_key",
969
+ "aws_bedrock",
970
+ "claude_code",
971
+ "codex",
972
+ "coding_plan",
973
+ "kimi_code"
974
+ ],
975
+ "description": "Must belong to the provider: anthropic takes api_key, aws_bedrock or claude_code, openai api_key or codex, zai coding_plan, moonshot kimi_code."
955
976
  }
956
977
  }
957
978
  ],
@@ -1154,6 +1175,61 @@
1154
1175
  }
1155
1176
  }
1156
1177
  },
1178
+ "/api/organizations/{workspaceId}/ai-provider/kimi-code-usage": {
1179
+ "get": {
1180
+ "operationId": "workspacesAiProviderUsageKimiCode",
1181
+ "summary": "Read the session and monthly utilization of the workspace's Kimi Code. 400 when the workspace holds no Kimi Code key.",
1182
+ "tags": ["workspaces"],
1183
+ "x-kosuke-command": ["workspaces", "ai-provider", "usage", "kimi-code"],
1184
+ "x-kosuke-sandbox-token": true,
1185
+ "x-kosuke-orchestrator-token": true,
1186
+ "x-kosuke-cron-token": true,
1187
+ "x-kosuke-lead-token": true,
1188
+ "parameters": [
1189
+ {
1190
+ "name": "workspaceId",
1191
+ "in": "path",
1192
+ "required": true,
1193
+ "schema": {
1194
+ "type": "string",
1195
+ "minLength": 1
1196
+ }
1197
+ }
1198
+ ],
1199
+ "responses": {
1200
+ "2XX": {
1201
+ "description": "Success envelope",
1202
+ "content": {
1203
+ "application/json": {
1204
+ "schema": {
1205
+ "$ref": "#/components/schemas/ApiSuccess"
1206
+ }
1207
+ }
1208
+ }
1209
+ },
1210
+ "4XX": {
1211
+ "description": "Error envelope",
1212
+ "content": {
1213
+ "application/json": {
1214
+ "schema": {
1215
+ "$ref": "#/components/schemas/ApiError"
1216
+ }
1217
+ }
1218
+ }
1219
+ },
1220
+ "5XX": {
1221
+ "description": "Error envelope",
1222
+ "content": {
1223
+ "application/json": {
1224
+ "schema": {
1225
+ "$ref": "#/components/schemas/ApiError"
1226
+ }
1227
+ }
1228
+ }
1229
+ }
1230
+ }
1231
+ }
1232
+ },
1157
1233
  "/api/organizations/{workspaceId}/artifacts/search": {
1158
1234
  "get": {
1159
1235
  "operationId": "workspacesArtifacts",
@@ -12647,7 +12723,7 @@
12647
12723
  "/api/user/subscriptions": {
12648
12724
  "get": {
12649
12725
  "operationId": "userSubscriptionsGet",
12650
- "summary": "Read your Claude, Codex and GLM Coding Plan subscriptions (connected, needsReauth, accountEmail) and your default model.",
12726
+ "summary": "Read your Claude, Codex, GLM Coding Plan and Kimi Code subscriptions (connected, needsReauth, accountEmail, and maskedApiKey for a pasted plan key) and your default model.",
12651
12727
  "tags": ["user"],
12652
12728
  "x-kosuke-command": ["user", "subscriptions", "get"],
12653
12729
  "x-kosuke-sandbox-token": true,
@@ -12745,7 +12821,7 @@
12745
12821
  "/api/user/subscriptions/{provider}": {
12746
12822
  "put": {
12747
12823
  "operationId": "userSubscriptionsSetKey",
12748
- "summary": "Connect your GLM Coding Plan by its API key, zai only: Claude and Codex connect by signing in. The key is tested with one call before it is kept.",
12824
+ "summary": "Connect your GLM Coding Plan (zai) or Kimi Code (moonshot) by its API key: Claude and Codex connect by signing in. The key is tested with one call before it is kept.",
12749
12825
  "tags": ["user"],
12750
12826
  "x-kosuke-command": ["user", "subscriptions", "set-key"],
12751
12827
  "parameters": [
@@ -12755,7 +12831,7 @@
12755
12831
  "required": true,
12756
12832
  "schema": {
12757
12833
  "type": "string",
12758
- "enum": ["anthropic", "openai", "zai"]
12834
+ "enum": ["anthropic", "openai", "zai", "moonshot"]
12759
12835
  }
12760
12836
  }
12761
12837
  ],
@@ -12811,7 +12887,7 @@
12811
12887
  },
12812
12888
  "delete": {
12813
12889
  "operationId": "userSubscriptionsDelete",
12814
- "summary": "Disconnect your subscription for one provider, anthropic, openai or zai, and release the sandboxes running on it. Answers 204.",
12890
+ "summary": "Disconnect your subscription for one provider, anthropic, openai, zai or moonshot, and release the sandboxes running on it. Answers 204.",
12815
12891
  "tags": ["user"],
12816
12892
  "x-kosuke-command": ["user", "subscriptions", "delete"],
12817
12893
  "parameters": [
@@ -12821,7 +12897,7 @@
12821
12897
  "required": true,
12822
12898
  "schema": {
12823
12899
  "type": "string",
12824
- "enum": ["anthropic", "openai", "zai"]
12900
+ "enum": ["anthropic", "openai", "zai", "moonshot"]
12825
12901
  }
12826
12902
  }
12827
12903
  ],
@@ -13060,7 +13136,7 @@
13060
13136
  "/api/user/subscriptions/usage": {
13061
13137
  "get": {
13062
13138
  "operationId": "userSubscriptionsUsage",
13063
- "summary": "Read the session and weekly utilization of your Claude (claude_code, the default), Codex or GLM Coding Plan (coding_plan) subscription. 400 when it is not connected or needs reconnecting.",
13139
+ "summary": "Read the session and weekly utilization of your Claude (claude_code, the default), Codex, GLM Coding Plan (coding_plan) or Kimi Code (kimi_code) subscription; Kimi Code reports a monthly window instead of a weekly one. 400 when it is not connected or needs reconnecting.",
13064
13140
  "tags": ["user"],
13065
13141
  "x-kosuke-command": ["user", "subscriptions", "usage"],
13066
13142
  "x-kosuke-sandbox-token": true,
@@ -13075,7 +13151,7 @@
13075
13151
  "schema": {
13076
13152
  "default": "claude_code",
13077
13153
  "type": "string",
13078
- "enum": ["claude_code", "codex", "coding_plan"]
13154
+ "enum": ["claude_code", "codex", "coding_plan", "kimi_code"]
13079
13155
  }
13080
13156
  }
13081
13157
  ],
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@kosuke-ai/cli",
3
- "version": "5.14.0",
3
+ "version": "5.15.0",
4
4
  "description": "Kosuke platform CLI. The client customers install to drive app.kosuke.ai from their own machine.",
5
5
  "license": "MIT",
6
6
  "repository": {