@kosuke-ai/kosuke 1.0.161 → 1.0.162

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/CHANGELOG.md CHANGED
@@ -1,5 +1,9 @@
1
1
  # Changelog
2
2
 
3
+ ## 1.0.162
4
+
5
+ - Every Kosuke app now tells the server which version and build it is and what it runs on: the CLI, the Mac app, the iPhone app and the Watch send an `X-Kosuke-Client` header such as `mac/0.1.109 (macOS 15.1.1; MacBookPro18,3; arm64)`, and the Mac, iPhone and Watch also report their OS version and model when they register.
6
+
3
7
  ## 1.0.161
4
8
 
5
9
  - `kosuke integrations list --toolkit` takes an MCP server's toolkit, such as `mcp-deepwiki`: the tools of an MCP server you or a workspace admin added in Settings, Integrations.
@@ -3,6 +3,7 @@ import { appendFile, lstat, readFile } from 'node:fs/promises';
3
3
  import { isAbsolute } from 'node:path';
4
4
  import { agentTokenOf } from '../runtime/agent-tokens.js';
5
5
  import { groupFor, leafAt } from '../runtime/attach.js';
6
+ import { CLIENT_HEADER, clientHeader } from '../runtime/client-header.js';
6
7
  import { OWN_TEXT } from '../runtime/help.js';
7
8
  import { HAND_WRITTEN } from './hand-written.js';
8
9
  const FLAGS = new Set([
@@ -191,6 +192,7 @@ export async function runSkillMarkerCommand(argv, options = {}) {
191
192
  headers: {
192
193
  authorization: `Bearer ${env.KOSUKE_API_KEY}`,
193
194
  'content-type': 'application/json',
195
+ [CLIENT_HEADER]: clientHeader,
194
196
  },
195
197
  body: JSON.stringify(marker),
196
198
  signal: controller.signal,
@@ -6,7 +6,7 @@ export const operation = {
6
6
  "push-devices",
7
7
  "create"
8
8
  ],
9
- "summary": "Register an iPhone or Apple Watch for push notifications with its hex APNs device token, the app bundle id it was issued to and its APNs environment. A token already registered moves to you. The Watch also sends its installationId and a generation it raises on every registration; one older than the registration already held for that installation answers 409. Both apps send their appVersion, which decides the notification categories they are sent. Called by the Sensei iOS and Watch apps; answers 204.",
9
+ "summary": "Register an iPhone or Apple Watch for push notifications with its hex APNs device token, the app bundle id it was issued to and its APNs environment. A token already registered moves to you. The Watch also sends its installationId and a generation it raises on every registration; one older than the registration already held for that installation answers 409. Both apps send their appVersion, which decides the notification categories they are sent, and may send their osVersion, model and build, kept on the device; one that does not read is left out, never refused. Called by the Sensei iOS and Watch apps; answers 204.",
10
10
  "pathParams": [],
11
11
  "query": [],
12
12
  "body": {
@@ -66,6 +66,27 @@ export const operation = {
66
66
  "flag": "app-version",
67
67
  "kind": "string",
68
68
  "required": false
69
+ },
70
+ {
71
+ "name": "osVersion",
72
+ "flag": "os-version",
73
+ "kind": "string",
74
+ "required": false,
75
+ "description": "The OS version, such as 18.1."
76
+ },
77
+ {
78
+ "name": "model",
79
+ "flag": "model",
80
+ "kind": "string",
81
+ "required": false,
82
+ "description": "The machine identifier, such as iPhone16,2 or Watch7,1."
83
+ },
84
+ {
85
+ "name": "build",
86
+ "flag": "build",
87
+ "kind": "string",
88
+ "required": false,
89
+ "description": "The build's CFBundleVersion, such as 212."
69
90
  }
70
91
  ],
71
92
  "required": true
@@ -0,0 +1,34 @@
1
+ import { release } from 'node:os';
2
+ import { version } from './version.js';
3
+ /** The header every Kosuke client sends, so the platform knows which app, at which version, on which OS. */
4
+ export const CLIENT_HEADER = 'X-Kosuke-Client';
5
+ /** The arch tokens the platform reads as an arch when it is the only item after the OS. */
6
+ const KNOWN_ARCHES = new Set(['arm64', 'aarch64', 'x86_64', 'x64', 'ia32', 'arm']);
7
+ /** `value` kept to `allowed` characters (others become `_`) and `max` long; null when empty. */
8
+ function token(value, allowed, max) {
9
+ const kept = value.replace(allowed, '_').slice(0, max);
10
+ return kept ? kept : null;
11
+ }
12
+ /**
13
+ * `cli/<version> (<platform> <osRelease>; <arch>)`, e.g. `cli/10.26.0 (darwin 24.1.0; arm64)`.
14
+ * Each part is reduced to the characters the platform accepts rather than sent raw; a part that
15
+ * is left empty is dropped, and an arch the platform would not read as one is left out.
16
+ */
17
+ function clientHeaderValue(info) {
18
+ const product = `cli/${token(info.version, /[^0-9A-Za-z._-]/g, 64) ?? '0'}`;
19
+ // process.platform is letters and digits (`win32`).
20
+ const os = token(info.platform, /[^A-Za-z0-9]/g, 32);
21
+ if (!os)
22
+ return product;
23
+ const osVersion = token(info.osRelease, /[^0-9A-Za-z._-]/g, 32);
24
+ const arch = KNOWN_ARCHES.has(info.arch) ? info.arch : null;
25
+ const system = [osVersion ? `${os} ${osVersion}` : os, ...(arch ? [arch] : [])].join('; ');
26
+ return `${product} (${system})`;
27
+ }
28
+ /** This CLI's header value, on this machine. */
29
+ export const clientHeader = clientHeaderValue({
30
+ version,
31
+ platform: process.platform,
32
+ osRelease: release(),
33
+ arch: process.arch,
34
+ });
@@ -1,4 +1,5 @@
1
1
  import createClient, {} from 'openapi-fetch';
2
+ import { CLIENT_HEADER, clientHeader } from './client-header.js';
2
3
  import { version } from './version.js';
3
4
  const MAX_ATTEMPTS = 3;
4
5
  // A few hundred ms, growing: this sits in front of a human or agent waiting
@@ -202,6 +203,7 @@ export function createApiClient({ apiUrl, apiKey, fetch, answerTimeoutMs, }) {
202
203
  headers: {
203
204
  ...(apiKey ? { Authorization: `Bearer ${apiKey}` } : {}),
204
205
  'User-Agent': `@kosuke-ai/kosuke/${version}`,
206
+ [CLIENT_HEADER]: clientHeader,
205
207
  },
206
208
  fetch: withIntegrationCap(withTransportRetry(answerTimeoutMs === undefined ? base : withAnswerTimeout(base, answerTimeoutMs))),
207
209
  });
package/openapi.json CHANGED
@@ -23210,7 +23210,7 @@
23210
23210
  "/api/push/devices": {
23211
23211
  "post": {
23212
23212
  "operationId": "userPushDevicesCreate",
23213
- "summary": "Register an iPhone or Apple Watch for push notifications with its hex APNs device token, the app bundle id it was issued to and its APNs environment. A token already registered moves to you. The Watch also sends its installationId and a generation it raises on every registration; one older than the registration already held for that installation answers 409. Both apps send their appVersion, which decides the notification categories they are sent. Called by the Sensei iOS and Watch apps; answers 204.",
23213
+ "summary": "Register an iPhone or Apple Watch for push notifications with its hex APNs device token, the app bundle id it was issued to and its APNs environment. A token already registered moves to you. The Watch also sends its installationId and a generation it raises on every registration; one older than the registration already held for that installation answers 409. Both apps send their appVersion, which decides the notification categories they are sent, and may send their osVersion, model and build, kept on the device; one that does not read is left out, never refused. Called by the Sensei iOS and Watch apps; answers 204.",
23214
23214
  "tags": ["user"],
23215
23215
  "x-kosuke-command": ["user", "push-devices", "create"],
23216
23216
  "x-kosuke-sandbox-token": true,
@@ -23259,6 +23259,27 @@
23259
23259
  "appVersion": {
23260
23260
  "type": "string",
23261
23261
  "pattern": "^\\d{1,6}(\\.\\d{1,6}){0,3}$"
23262
+ },
23263
+ "osVersion": {
23264
+ "description": "The OS version, such as 18.1.",
23265
+ "type": "string",
23266
+ "minLength": 1,
23267
+ "maxLength": 32,
23268
+ "pattern": "^[0-9A-Za-z._-]+$"
23269
+ },
23270
+ "model": {
23271
+ "description": "The machine identifier, such as iPhone16,2 or Watch7,1.",
23272
+ "type": "string",
23273
+ "minLength": 1,
23274
+ "maxLength": 64,
23275
+ "pattern": "^[A-Za-z0-9,._-]+$"
23276
+ },
23277
+ "build": {
23278
+ "description": "The build's CFBundleVersion, such as 212.",
23279
+ "type": "string",
23280
+ "minLength": 1,
23281
+ "maxLength": 64,
23282
+ "pattern": "^[0-9A-Za-z._-]+$"
23262
23283
  }
23263
23284
  },
23264
23285
  "required": ["token", "platform", "bundleId", "environment"]
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@kosuke-ai/kosuke",
3
- "version": "1.0.161",
3
+ "version": "1.0.162",
4
4
  "description": "Sensei platform CLI. The client customers install to drive app.kosuke.ai from their own machine.",
5
5
  "license": "MIT",
6
6
  "repository": {
@@ -43,10 +43,10 @@
43
43
  "minimatch": "^11.0.1"
44
44
  },
45
45
  "kosukeRelease": {
46
- "sourceCommit": "9f1dc5e31fbb2a07ae406daf07478dcc24126b0b",
47
- "sourceIdentity": "f9c8e0e5e551b1388402cc6924e0f669738293f6e46a3d101f03de8b4aafd022",
46
+ "sourceCommit": "589a3b275171b184b2e8b7bf16ed858138faf8c4",
47
+ "sourceIdentity": "5091abaf88aa449901897bdd1a59050f8bd322fb0ee16814a7924064fddb8e9c",
48
48
  "fragments": [
49
- "mcp-servers-list-toolkit-sd76l0.json"
49
+ "client-version-header-x49q1x.json"
50
50
  ]
51
51
  }
52
52
  }