@anycon/sdk 0.4.2 → 0.4.3

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/README.md CHANGED
@@ -12,12 +12,12 @@ npm install @anycon/sdk
12
12
  ```ts
13
13
  import { pair, connect, policies } from '@anycon/sdk'
14
14
 
15
- const hub = 'https://hub.example.com'
15
+ const hub = 'https://hub.anycon.ai'
16
16
 
17
17
  // Once: run `anycon pair` on the node to get a pairing code (16 characters by default; `--short`
18
18
  // gives 8, which is only suitable for a self-hosted hub). You can also pass the pairing link.
19
19
  await pair(hub, { code: '7K3P-Q2MX-W4NH-8CRD', name: 'ci-runner' })
20
- // await pair(hub, { code: 'https://hub.example.com/pair#code=7K3P-Q2MX-W4NH-8CRD', name: 'ci-runner' })
20
+ // await pair(hub, { code: 'https://hub.anycon.ai/pair#code=7K3P-Q2MX-W4NH-8CRD', name: 'ci-runner' })
21
21
 
22
22
  const node = await connect(hub, { node: 'mac-mini' }) // `node` can be left out when only one node is paired
23
23
  const agents = await node.agents.list() // the valid model / thinking / permission-mode values come from here
package/README.zh-CN.md CHANGED
@@ -9,10 +9,10 @@ Node ≥ 20 与浏览器同构(Node 用 `ws`,浏览器用原生 WebSocket)
9
9
  import { pair, connect, policies } from '@anycon/sdk'
10
10
 
11
11
  // 一次性:在节点上 `anycon pair` 拿到短码(默认 16 位;`--short` 是 8 位,只适合自建 hub);也可以直接给配对链接
12
- await pair('https://hub.example.com', { code: '7K3P-Q2MX-W4NH-8CRD', name: 'ci-runner' })
13
- // await pair(hub, { code: 'https://hub.example.com/pair#code=7K3P-Q2MX-W4NH-8CRD', name: 'ci-runner' })
12
+ await pair('https://hub.anycon.ai', { code: '7K3P-Q2MX-W4NH-8CRD', name: 'ci-runner' })
13
+ // await pair(hub, { code: 'https://hub.anycon.ai/pair#code=7K3P-Q2MX-W4NH-8CRD', name: 'ci-runner' })
14
14
 
15
- const node = await connect('https://hub.example.com', { node: 'mac-mini' }) // 只配对了一个节点时可省略
15
+ const node = await connect('https://hub.anycon.ai', { node: 'mac-mini' }) // 只配对了一个节点时可省略
16
16
  const agents = await node.agents.list() // 模型 / 思考 / 权限模式的取值来自这里
17
17
  const session = await node.sessions.create({
18
18
  project: 'app', agent: 'claude-code',
package/dist/index.d.ts CHANGED
@@ -3,8 +3,8 @@
3
3
  *
4
4
  * ```ts
5
5
  * import { pair, connect } from '@anycon/sdk'
6
- * await pair('https://hub.example.com', { code: '7K3P-Q2MX-W4NH-8CRD', name: 'ci-runner' }) // 一次性(默认 16 位短码,`--short` 是 8 位,或 #code= 链接)
7
- * const node = await connect('https://hub.example.com', { node: 'mac-mini' })
6
+ * await pair('https://hub.anycon.ai', { code: '7K3P-Q2MX-W4NH-8CRD', name: 'ci-runner' }) // 一次性(默认 16 位短码,`--short` 是 8 位,或 #code= 链接)
7
+ * const node = await connect('https://hub.anycon.ai', { node: 'mac-mini' })
8
8
  * const session = await node.sessions.create({ agent: 'claude-code', project: 'app' })
9
9
  * for await (const ev of session.send('跑一下测试')) {
10
10
  * if (ev.type === 'text_delta') process.stdout.write(ev.text)
package/dist/index.js CHANGED
@@ -3,8 +3,8 @@
3
3
  *
4
4
  * ```ts
5
5
  * import { pair, connect } from '@anycon/sdk'
6
- * await pair('https://hub.example.com', { code: '7K3P-Q2MX-W4NH-8CRD', name: 'ci-runner' }) // 一次性(默认 16 位短码,`--short` 是 8 位,或 #code= 链接)
7
- * const node = await connect('https://hub.example.com', { node: 'mac-mini' })
6
+ * await pair('https://hub.anycon.ai', { code: '7K3P-Q2MX-W4NH-8CRD', name: 'ci-runner' }) // 一次性(默认 16 位短码,`--short` 是 8 位,或 #code= 链接)
7
+ * const node = await connect('https://hub.anycon.ai', { node: 'mac-mini' })
8
8
  * const session = await node.sessions.create({ agent: 'claude-code', project: 'app' })
9
9
  * for await (const ev of session.send('跑一下测试')) {
10
10
  * if (ev.type === 'text_delta') process.stdout.write(ev.text)
package/dist/pair.d.ts CHANGED
@@ -23,7 +23,7 @@ export declare const PAIR_ACK_TIMEOUT_MS = 30000;
23
23
  export interface PairOptions {
24
24
  /**
25
25
  * 在节点上 `anycon pair` 得到的短码:默认是 16 位 `XXXX-XXXX-XXXX-XXXX`,`anycon pair --short` 是 8 位 `XXXX-XXXX`,
26
- * 大小写和连字符随意;也可以直接给配对链接(`https://hub.example.com/pair#code=XXXX-XXXX-XXXX-XXXX`)或 `#code=…`。
26
+ * 大小写和连字符随意;也可以直接给配对链接(`https://hub.anycon.ai/pair#code=XXXX-XXXX-XXXX-XXXX`)或 `#code=…`。
27
27
  */
28
28
  code: string;
29
29
  /** 这台设备的显示名,节点上 `anycon devices` 里看到的就是它。 */
package/dist/version.d.ts CHANGED
@@ -1,3 +1,3 @@
1
1
  /** SDK 版本。与 package.json 一致(`tests/version.test.ts` 守着)。 */
2
- export declare const SDK_VERSION = "0.4.2";
2
+ export declare const SDK_VERSION = "0.4.3";
3
3
  //# sourceMappingURL=version.d.ts.map
package/dist/version.js CHANGED
@@ -1,3 +1,3 @@
1
1
  /** SDK 版本。与 package.json 一致(`tests/version.test.ts` 守着)。 */
2
- export const SDK_VERSION = '0.4.2';
2
+ export const SDK_VERSION = '0.4.3';
3
3
  //# sourceMappingURL=version.js.map
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@anycon/sdk",
3
- "version": "0.4.2",
3
+ "version": "0.4.3",
4
4
  "description": "Anycon TypeScript SDK (client side): pairing, connecting to nodes, sessions, and permissions. Works in Node and the browser.",
5
5
  "homepage": "https://github.com/anycon-ai/anycon/tree/main/packages/sdk#readme",
6
6
  "bugs": {
@@ -48,7 +48,7 @@
48
48
  "prepack": "rm -rf dist && bun run build"
49
49
  },
50
50
  "dependencies": {
51
- "@anycon/protocol": "0.4.2",
51
+ "@anycon/protocol": "0.4.3",
52
52
  "ws": "^8.23.0"
53
53
  },
54
54
  "devDependencies": {
package/src/index.ts CHANGED
@@ -3,8 +3,8 @@
3
3
  *
4
4
  * ```ts
5
5
  * import { pair, connect } from '@anycon/sdk'
6
- * await pair('https://hub.example.com', { code: '7K3P-Q2MX-W4NH-8CRD', name: 'ci-runner' }) // 一次性(默认 16 位短码,`--short` 是 8 位,或 #code= 链接)
7
- * const node = await connect('https://hub.example.com', { node: 'mac-mini' })
6
+ * await pair('https://hub.anycon.ai', { code: '7K3P-Q2MX-W4NH-8CRD', name: 'ci-runner' }) // 一次性(默认 16 位短码,`--short` 是 8 位,或 #code= 链接)
7
+ * const node = await connect('https://hub.anycon.ai', { node: 'mac-mini' })
8
8
  * const session = await node.sessions.create({ agent: 'claude-code', project: 'app' })
9
9
  * for await (const ev of session.send('跑一下测试')) {
10
10
  * if (ev.type === 'text_delta') process.stdout.write(ev.text)
package/src/pair.ts CHANGED
@@ -45,7 +45,7 @@ export const PAIR_ACK_TIMEOUT_MS = 30_000
45
45
  export interface PairOptions {
46
46
  /**
47
47
  * 在节点上 `anycon pair` 得到的短码:默认是 16 位 `XXXX-XXXX-XXXX-XXXX`,`anycon pair --short` 是 8 位 `XXXX-XXXX`,
48
- * 大小写和连字符随意;也可以直接给配对链接(`https://hub.example.com/pair#code=XXXX-XXXX-XXXX-XXXX`)或 `#code=…`。
48
+ * 大小写和连字符随意;也可以直接给配对链接(`https://hub.anycon.ai/pair#code=XXXX-XXXX-XXXX-XXXX`)或 `#code=…`。
49
49
  */
50
50
  code: string
51
51
  /** 这台设备的显示名,节点上 `anycon devices` 里看到的就是它。 */
package/src/version.ts CHANGED
@@ -1,2 +1,2 @@
1
1
  /** SDK 版本。与 package.json 一致(`tests/version.test.ts` 守着)。 */
2
- export const SDK_VERSION = '0.4.2'
2
+ export const SDK_VERSION = '0.4.3'