@kin-tio/cli 0.6.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.
Files changed (66) hide show
  1. package/.env.example +46 -0
  2. package/CHANGELOG.md +95 -0
  3. package/LICENSE +202 -0
  4. package/README.md +150 -0
  5. package/README.zh-CN.md +79 -0
  6. package/THIRD_PARTY_NOTICES +31 -0
  7. package/assets/ilink-login-card.png +0 -0
  8. package/bin/kintio.js +3 -0
  9. package/codex-workspace/.agents/skills/wechat-kf-reply-sop/SKILL.md +58 -0
  10. package/dist/cli.js +3 -0
  11. package/dist/daemon.js +28 -0
  12. package/dist/index.js +70 -0
  13. package/dist/mcp-relay.js +11 -0
  14. package/dist/src/agent/runtime.js +1 -0
  15. package/dist/src/app.js +34 -0
  16. package/dist/src/cli.js +578 -0
  17. package/dist/src/config.js +237 -0
  18. package/dist/src/domain/message.js +23 -0
  19. package/dist/src/domain/send-contract.js +205 -0
  20. package/dist/src/domain/wecom-message.js +281 -0
  21. package/dist/src/ilink/executor.js +306 -0
  22. package/dist/src/ilink/inbound-image.js +310 -0
  23. package/dist/src/ilink/listener.js +306 -0
  24. package/dist/src/ilink/login-manager.js +198 -0
  25. package/dist/src/ilink/login-store.js +197 -0
  26. package/dist/src/ilink/media-gateway.js +83 -0
  27. package/dist/src/ilink/media.js +267 -0
  28. package/dist/src/ilink/message.js +247 -0
  29. package/dist/src/ilink/protocol/client.js +464 -0
  30. package/dist/src/ilink/protocol/types.js +35 -0
  31. package/dist/src/ilink/qr.js +109 -0
  32. package/dist/src/ilink/secret-box.js +143 -0
  33. package/dist/src/ilink/sqlite-store.js +1194 -0
  34. package/dist/src/ilink/store-types.js +63 -0
  35. package/dist/src/lib/image-format.js +23 -0
  36. package/dist/src/lib/path-identity.js +38 -0
  37. package/dist/src/lib/private-directory.js +51 -0
  38. package/dist/src/lib/text.js +19 -0
  39. package/dist/src/lib/wecom-crypto.js +74 -0
  40. package/dist/src/lib/xml.js +8 -0
  41. package/dist/src/mcp/conversation-memory-server.js +179 -0
  42. package/dist/src/mcp/ilink-server.js +158 -0
  43. package/dist/src/mcp/ipc-host.js +275 -0
  44. package/dist/src/mcp/ipc-protocol.js +226 -0
  45. package/dist/src/mcp/stdio-relay.js +122 -0
  46. package/dist/src/mcp/wechat-kf-executor.js +295 -0
  47. package/dist/src/mcp/wechat-kf-server.js +208 -0
  48. package/dist/src/routes/wecom.js +89 -0
  49. package/dist/src/runtime/daemon-protocol.js +202 -0
  50. package/dist/src/runtime/managed-skill.js +49 -0
  51. package/dist/src/runtime/native-daemon.js +325 -0
  52. package/dist/src/runtime/single-instance-lock.js +167 -0
  53. package/dist/src/runtime.js +503 -0
  54. package/dist/src/services/codex-agent.js +542 -0
  55. package/dist/src/services/codex-app-server.js +436 -0
  56. package/dist/src/services/conversation-processor.js +762 -0
  57. package/dist/src/services/image-stager.js +49 -0
  58. package/dist/src/services/media-gateway.js +83 -0
  59. package/dist/src/services/wecom-api.js +311 -0
  60. package/dist/src/services/wecom-sync.js +316 -0
  61. package/dist/src/state/persistence.js +124 -0
  62. package/dist/src/state/sqlite-store.js +3102 -0
  63. package/dist/src/supervisor.js +212 -0
  64. package/dist/src/types.js +1 -0
  65. package/dist/src/version.js +1 -0
  66. package/package.json +72 -0
package/.env.example ADDED
@@ -0,0 +1,46 @@
1
+ # `kintio setup` installs this template as <instance>/.env with mode 0600.
2
+ # Relative file paths resolve from that instance directory.
3
+ PORT=8888
4
+ # Fill all four WECOM values only when the WeChat KF channel is enabled.
5
+ # Leave them empty for an existing-account iLink-only deployment.
6
+ WECOM_CALLBACK_TOKEN=
7
+ WECOM_ENCODING_AES_KEY=
8
+
9
+ WECOM_CORP_ID=
10
+ WECOM_KF_SECRET=
11
+
12
+ # Codex is denied for every conversation user until IDs are explicitly allowlisted.
13
+ # Use a comma-separated list such as wm_user_a,wm_user_b.
14
+ # Wildcards are rejected; every entry must be an explicit external_userid.
15
+ WECOM_ALLOWED_USER_IDS=
16
+
17
+ # Optional self-authorization. Disabled while the trigger is empty.
18
+ # An unauthorized user must send the exact trigger as consecutive messages.
19
+ WECOM_AUTH_TRIGGER=
20
+ WECOM_AUTH_TRIGGER_COUNT=3
21
+ WECOM_AUTH_CONFIRMATION=Code accepted. You can continue the conversation.
22
+
23
+ # Optional runtime settings.
24
+ # WECOM_RECEIVE_ID defaults to WECOM_CORP_ID.
25
+ # KINTIO_DB_FILE=./data/kintio.sqlite
26
+ # Legacy TALKFERRY_DB_FILE, HARNESS_DB_FILE, and WECOM_DB_FILE aliases remain supported.
27
+ # WECOM_API_TIMEOUT_MS=10000
28
+ # WECOM_MCP_OBSERVE_MS=5000
29
+ # SHUTDOWN_TIMEOUT_MS=10000
30
+
31
+ # Optional Weixin iLink channel. Generate a 32-byte base64url key and keep it in
32
+ # the deployment secret store; Bot and context tokens are encrypted with it.
33
+ ILINK_ENABLED=false
34
+ # Prefer a deployment-secret value. If omitted, the service creates a private
35
+ # 0600 key file beside SQLite; never register that key with a chat Agent.
36
+ # ILINK_STORAGE_KEY=replace_with_43_character_base64url_key
37
+ # ILINK_STORAGE_KEY_FILE=./data/ilink-storage.key
38
+ # ILINK_BASE_URL=https://ilinkai.weixin.qq.com/
39
+ # ILINK_API_TIMEOUT_MS=15000
40
+ # ILINK_LONG_POLL_TIMEOUT_MS=35000
41
+ # ILINK_MAX_ACCOUNTS=20
42
+
43
+ # Codex CLI app-server uses the existing local Codex login.
44
+ CODEX_ENABLED=true
45
+ # CODEX_IMAGE_TMP_DIR=./data/codex-input
46
+ # CODEX_WORKING_DIRECTORY=./codex-workspace
package/CHANGELOG.md ADDED
@@ -0,0 +1,95 @@
1
+ # Changelog
2
+
3
+ This file records important user-visible changes after the first public release.
4
+
5
+ ## Unreleased
6
+
7
+ ## 0.6.0 - 2026-08-31
8
+
9
+ - Published the global `kintio` command as `@kin-tio/cli` through the public
10
+ npm Registry and added exact tarball and clean Registry-install verification
11
+ ([#37](https://github.com/Gkxie/kintio/issues/37)).
12
+ - Disabled persisted Codex Goals and multi-agent tools inside untrusted channel
13
+ sessions so conversation work cannot outlive its bounded turn or expand into
14
+ background Agent execution
15
+ ([#38](https://github.com/Gkxie/kintio/issues/38)).
16
+ - Made `~/.kintio` the single default mutable instance root for global and
17
+ direct Worker entry points, hardened foreground and daemon-first crash cleanup,
18
+ and constrained Windows-owned state to the selected Profile instance without
19
+ restricting the Agent project directory
20
+ ([#32](https://github.com/Gkxie/kintio/issues/32)).
21
+ - Made one Worker-owned persistence root the only production owner of the raw
22
+ SQLite connection; Runtime, channels, MCP, and Agent code now consume JS/TS
23
+ state facades instead of a public database handle
24
+ ([#29](https://github.com/Gkxie/kintio/issues/29)).
25
+ - Installed and refreshed the managed conversation Skill in the effective
26
+ configured Agent workspace, so a custom `CODEX_WORKING_DIRECTORY` cannot
27
+ leave a dangling session-level Skill reference
28
+ ([#30](https://github.com/Gkxie/kintio/issues/30)).
29
+ - Moved MCP actions off HTTP entirely: Codex now starts true stdio relays backed
30
+ by a private Unix-domain socket or Windows named pipe, with no MCP TCP port or
31
+ static URL/Bearer configuration. The Codex adapter continues to inherit host
32
+ model, provider, reasoning, and search settings
33
+ ([#21](https://github.com/Gkxie/kintio/issues/21),
34
+ [#27](https://github.com/Gkxie/kintio/issues/27)).
35
+ - Added macOS, Linux, and Windows lifecycle support with an authenticated native
36
+ daemon, bounded worker restarts, rotated logs, portable path and temporary-file
37
+ handling, and a three-system CI matrix
38
+ ([#19](https://github.com/Gkxie/kintio/issues/19)).
39
+ - Removed duplicate post-merge CI, coverage artifact round trips, redundant
40
+ registry audits, and brittle repository-policy snapshots; retained the
41
+ executable security boundaries and made Agent subprocesses inherit the host
42
+ environment without copying Kintio configuration-file values into it
43
+ ([#16](https://github.com/Gkxie/kintio/issues/16)).
44
+ - Made iLink activation explicit with `ILINK_ENABLED=true`, fixed an
45
+ authorization race that could defer an already-authorized message until
46
+ restart, and stopped opt-in tests and low-level Codex processes from
47
+ inheriting unrelated deployment credentials
48
+ ([#14](https://github.com/Gkxie/kintio/issues/14)).
49
+ - Replaced the custom CLA parser and ledger writer with the immutable,
50
+ SHA-pinned CLA Assistant Lite workflow used by OpenAI Codex, while retaining
51
+ public signature records in the protected `cla-signatures` branch
52
+ ([#11](https://github.com/Gkxie/kintio/issues/11)).
53
+
54
+ ## 0.5.0 - 2026-08-30
55
+
56
+ - Added a global `kintio` command with secure setup, foreground execution, and
57
+ PM2-backed start, stop, restart, status, and log operations
58
+ ([#5](https://github.com/Gkxie/kintio/pull/5)).
59
+ - Separated installed program files from instance configuration, SQLite state,
60
+ temporary media, and the Agent workspace under `~/.kintio` by default.
61
+ - Made an application Supervisor the process composition root; Hono now remains
62
+ an HTTP callback and MCP channel beside polling and future WebSocket inputs.
63
+ - Rendered optional iLink login invitations as branded QR cards with an explicit
64
+ five-minute validity notice
65
+ ([#6](https://github.com/Gkxie/kintio/pull/6)).
66
+
67
+ ## 0.4.1 - 2026-08-30
68
+
69
+ - Removed wildcard WeChat authorization; `WECOM_ALLOWED_USER_IDS` now accepts
70
+ explicit `external_userid` values only.
71
+ - Removed the unused `/healthz` endpoint; process state and the Hono startup log
72
+ remain the supported local liveness signals.
73
+
74
+ ## 0.4.0 - 2026-08-29
75
+
76
+ - Authorized channel users can assign work to a Codex Agent and receive results
77
+ in the originating conversation.
78
+ - Added WeChat Customer Service API and independent Weixin iLink Bot
79
+ conversations.
80
+ - Added text and image input, with text, image, link, mini-program, and location
81
+ delivery according to each adapter's capabilities.
82
+ - New user instructions steer the active Agent turn instead of receiving stale
83
+ answers in sequence.
84
+ - SQLite recovery resumes missed and unfinished messages after restart while
85
+ prioritizing live inbound traffic.
86
+ - Channel identities, Threads, media, and reply windows are isolated, and
87
+ provider secrets are not exposed to the Agent.
88
+ - Adopted the channel-neutral Kintio identity, English canonical documentation,
89
+ and one concise Simplified Chinese entry page.
90
+ - Added Hono lifecycle management, PM2 deployment guidance, SQLite durability,
91
+ and compatibility paths for existing deployments.
92
+ - Added deterministic unit, integration, recovery, and security tests with
93
+ coverage, TypeScript, dependency, secret, and CodeQL checks.
94
+ - Added repository-native CLA enforcement, contributor accountability,
95
+ release provenance checks, and an abuse-response runbook.
package/LICENSE ADDED
@@ -0,0 +1,202 @@
1
+
2
+ Apache License
3
+ Version 2.0, January 2004
4
+ http://www.apache.org/licenses/
5
+
6
+ TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION
7
+
8
+ 1. Definitions.
9
+
10
+ "License" shall mean the terms and conditions for use, reproduction,
11
+ and distribution as defined by Sections 1 through 9 of this document.
12
+
13
+ "Licensor" shall mean the copyright owner or entity authorized by
14
+ the copyright owner that is granting the License.
15
+
16
+ "Legal Entity" shall mean the union of the acting entity and all
17
+ other entities that control, are controlled by, or are under common
18
+ control with that entity. For the purposes of this definition,
19
+ "control" means (i) the power, direct or indirect, to cause the
20
+ direction or management of such entity, whether by contract or
21
+ otherwise, or (ii) ownership of fifty percent (50%) or more of the
22
+ outstanding shares, or (iii) beneficial ownership of such entity.
23
+
24
+ "You" (or "Your") shall mean an individual or Legal Entity
25
+ exercising permissions granted by this License.
26
+
27
+ "Source" form shall mean the preferred form for making modifications,
28
+ including but not limited to software source code, documentation
29
+ source, and configuration files.
30
+
31
+ "Object" form shall mean any form resulting from mechanical
32
+ transformation or translation of a Source form, including but
33
+ not limited to compiled object code, generated documentation,
34
+ and conversions to other media types.
35
+
36
+ "Work" shall mean the work of authorship, whether in Source or
37
+ Object form, made available under the License, as indicated by a
38
+ copyright notice that is included in or attached to the work
39
+ (an example is provided in the Appendix below).
40
+
41
+ "Derivative Works" shall mean any work, whether in Source or Object
42
+ form, that is based on (or derived from) the Work and for which the
43
+ editorial revisions, annotations, elaborations, or other modifications
44
+ represent, as a whole, an original work of authorship. For the purposes
45
+ of this License, Derivative Works shall not include works that remain
46
+ separable from, or merely link (or bind by name) to the interfaces of,
47
+ the Work and Derivative Works thereof.
48
+
49
+ "Contribution" shall mean any work of authorship, including
50
+ the original version of the Work and any modifications or additions
51
+ to that Work or Derivative Works thereof, that is intentionally
52
+ submitted to Licensor for inclusion in the Work by the copyright owner
53
+ or by an individual or Legal Entity authorized to submit on behalf of
54
+ the copyright owner. For the purposes of this definition, "submitted"
55
+ means any form of electronic, verbal, or written communication sent
56
+ to the Licensor or its representatives, including but not limited to
57
+ communication on electronic mailing lists, source code control systems,
58
+ and issue tracking systems that are managed by, or on behalf of, the
59
+ Licensor for the purpose of discussing and improving the Work, but
60
+ excluding communication that is conspicuously marked or otherwise
61
+ designated in writing by the copyright owner as "Not a Contribution."
62
+
63
+ "Contributor" shall mean Licensor and any individual or Legal Entity
64
+ on behalf of whom a Contribution has been received by Licensor and
65
+ subsequently incorporated within the Work.
66
+
67
+ 2. Grant of Copyright License. Subject to the terms and conditions of
68
+ this License, each Contributor hereby grants to You a perpetual,
69
+ worldwide, non-exclusive, no-charge, royalty-free, irrevocable
70
+ copyright license to reproduce, prepare Derivative Works of,
71
+ publicly display, publicly perform, sublicense, and distribute the
72
+ Work and such Derivative Works in Source or Object form.
73
+
74
+ 3. Grant of Patent License. Subject to the terms and conditions of
75
+ this License, each Contributor hereby grants to You a perpetual,
76
+ worldwide, non-exclusive, no-charge, royalty-free, irrevocable
77
+ (except as stated in this section) patent license to make, have made,
78
+ use, offer to sell, sell, import, and otherwise transfer the Work,
79
+ where such license applies only to those patent claims licensable
80
+ by such Contributor that are necessarily infringed by their
81
+ Contribution(s) alone or by combination of their Contribution(s)
82
+ with the Work to which such Contribution(s) was submitted. If You
83
+ institute patent litigation against any entity (including a
84
+ cross-claim or counterclaim in a lawsuit) alleging that the Work
85
+ or a Contribution incorporated within the Work constitutes direct
86
+ or contributory patent infringement, then any patent licenses
87
+ granted to You under this License for that Work shall terminate
88
+ as of the date such litigation is filed.
89
+
90
+ 4. Redistribution. You may reproduce and distribute copies of the
91
+ Work or Derivative Works thereof in any medium, with or without
92
+ modifications, and in Source or Object form, provided that You
93
+ meet the following conditions:
94
+
95
+ (a) You must give any other recipients of the Work or
96
+ Derivative Works a copy of this License; and
97
+
98
+ (b) You must cause any modified files to carry prominent notices
99
+ stating that You changed the files; and
100
+
101
+ (c) You must retain, in the Source form of any Derivative Works
102
+ that You distribute, all copyright, patent, trademark, and
103
+ attribution notices from the Source form of the Work,
104
+ excluding those notices that do not pertain to any part of
105
+ the Derivative Works; and
106
+
107
+ (d) If the Work includes a "NOTICE" text file as part of its
108
+ distribution, then any Derivative Works that You distribute must
109
+ include a readable copy of the attribution notices contained
110
+ within such NOTICE file, excluding those notices that do not
111
+ pertain to any part of the Derivative Works, in at least one
112
+ of the following places: within a NOTICE text file distributed
113
+ as part of the Derivative Works; within the Source form or
114
+ documentation, if provided along with the Derivative Works; or,
115
+ within a display generated by the Derivative Works, if and
116
+ wherever such third-party notices normally appear. The contents
117
+ of the NOTICE file are for informational purposes only and
118
+ do not modify the License. You may add Your own attribution
119
+ notices within Derivative Works that You distribute, alongside
120
+ or as an addendum to the NOTICE text from the Work, provided
121
+ that such additional attribution notices cannot be construed
122
+ as modifying the License.
123
+
124
+ You may add Your own copyright statement to Your modifications and
125
+ may provide additional or different license terms and conditions
126
+ for use, reproduction, or distribution of Your modifications, or
127
+ for any such Derivative Works as a whole, provided Your use,
128
+ reproduction, and distribution of the Work otherwise complies with
129
+ the conditions stated in this License.
130
+
131
+ 5. Submission of Contributions. Unless You explicitly state otherwise,
132
+ any Contribution intentionally submitted for inclusion in the Work
133
+ by You to the Licensor shall be under the terms and conditions of
134
+ this License, without any additional terms or conditions.
135
+ Notwithstanding the above, nothing herein shall supersede or modify
136
+ the terms of any separate license agreement you may have executed
137
+ with Licensor regarding such Contributions.
138
+
139
+ 6. Trademarks. This License does not grant permission to use the trade
140
+ names, trademarks, service marks, or product names of the Licensor,
141
+ except as required for reasonable and customary use in describing the
142
+ origin of the Work and reproducing the content of the NOTICE file.
143
+
144
+ 7. Disclaimer of Warranty. Unless required by applicable law or
145
+ agreed to in writing, Licensor provides the Work (and each
146
+ Contributor provides its Contributions) on an "AS IS" BASIS,
147
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
148
+ implied, including, without limitation, any warranties or conditions
149
+ of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A
150
+ PARTICULAR PURPOSE. You are solely responsible for determining the
151
+ appropriateness of using or redistributing the Work and assume any
152
+ risks associated with Your exercise of permissions under this License.
153
+
154
+ 8. Limitation of Liability. In no event and under no legal theory,
155
+ whether in tort (including negligence), contract, or otherwise,
156
+ unless required by applicable law (such as deliberate and grossly
157
+ negligent acts) or agreed to in writing, shall any Contributor be
158
+ liable to You for damages, including any direct, indirect, special,
159
+ incidental, or consequential damages of any character arising as a
160
+ result of this License or out of the use or inability to use the
161
+ Work (including but not limited to damages for loss of goodwill,
162
+ work stoppage, computer failure or malfunction, or any and all
163
+ other commercial damages or losses), even if such Contributor
164
+ has been advised of the possibility of such damages.
165
+
166
+ 9. Accepting Warranty or Additional Liability. While redistributing
167
+ the Work or Derivative Works thereof, You may choose to offer,
168
+ and charge a fee for, acceptance of support, warranty, indemnity,
169
+ or other liability obligations and/or rights consistent with this
170
+ License. However, in accepting such obligations, You may act only
171
+ on Your own behalf and on Your sole responsibility, not on behalf
172
+ of any other Contributor, and only if You agree to indemnify,
173
+ defend, and hold each Contributor harmless for any liability
174
+ incurred by, or claims asserted against, such Contributor by reason
175
+ of your accepting any such warranty or additional liability.
176
+
177
+ END OF TERMS AND CONDITIONS
178
+
179
+ APPENDIX: How to apply the Apache License to your work.
180
+
181
+ To apply the Apache License to your work, attach the following
182
+ boilerplate notice, with the fields enclosed by brackets "[]"
183
+ replaced with your own identifying information. (Don't include
184
+ the brackets!) The text should be enclosed in the appropriate
185
+ comment syntax for the file format. We also recommend that a
186
+ file or class name and description of purpose be included on the
187
+ same "printed page" as the copyright notice for easier
188
+ identification within third-party archives.
189
+
190
+ Copyright [yyyy] [name of copyright owner]
191
+
192
+ Licensed under the Apache License, Version 2.0 (the "License");
193
+ you may not use this file except in compliance with the License.
194
+ You may obtain a copy of the License at
195
+
196
+ http://www.apache.org/licenses/LICENSE-2.0
197
+
198
+ Unless required by applicable law or agreed to in writing, software
199
+ distributed under the License is distributed on an "AS IS" BASIS,
200
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
201
+ See the License for the specific language governing permissions and
202
+ limitations under the License.
package/README.md ADDED
@@ -0,0 +1,150 @@
1
+ <div align="center">
2
+
3
+ # Kintio
4
+
5
+ **Connect chat channels to an Agent you control.**
6
+
7
+ English | [简体中文](https://github.com/Gkxie/kintio/blob/master/README.zh-CN.md)
8
+
9
+ [![CI](https://github.com/Gkxie/kintio/actions/workflows/ci.yml/badge.svg)](https://github.com/Gkxie/kintio/actions/workflows/ci.yml)
10
+ [![CodeQL](https://github.com/Gkxie/kintio/actions/workflows/codeql.yml/badge.svg)](https://github.com/Gkxie/kintio/actions/workflows/codeql.yml)
11
+ [![Latest release](https://img.shields.io/github/v/release/Gkxie/kintio?display_name=tag)](https://github.com/Gkxie/kintio/releases/latest)
12
+ [![License](https://img.shields.io/github/license/Gkxie/kintio)](https://github.com/Gkxie/kintio/blob/master/LICENSE)
13
+
14
+ </div>
15
+
16
+ Deploy Kintio next to an Agent runtime and authorized people can assign work,
17
+ steer an active task, and receive results without leaving their chat app. Kintio
18
+ connects each
19
+ conversation to the Agent while keeping identities, state, and reply capabilities scoped to
20
+ the originating channel. The current runtime uses the Codex CLI session on the deployment
21
+ host.
22
+
23
+ ```text
24
+ Chat: "Investigate this" -> Kintio starts a task in the Agent on your machine
25
+ Chat: "Focus on the logs" -> Kintio steers that running task
26
+ Agent result -> Kintio delivers it back to the same chat
27
+ ```
28
+
29
+ ## What it provides
30
+
31
+ - A separate Agent thread for every adapter identity, with no implicit identity or history
32
+ merging across channels.
33
+ - Steering for active work: a user's follow-up can redirect the current Agent turn instead
34
+ of waiting behind stale instructions.
35
+ - A durable SQLite inbox, restart recovery, and live-message priority over backlog recovery.
36
+ - One application Supervisor for HTTP callbacks, polling listeners, and future long-lived
37
+ channel transports; Hono is an adapter rather than the process lifecycle owner.
38
+ - Session-scoped MCP actions that cannot choose another recipient or expose provider
39
+ credentials, raw user identifiers, or database paths to the Agent.
40
+ - Explicit delivery outcomes: accepted, failed, or uncertain. Uncertain sends are not
41
+ blindly retried.
42
+
43
+ One deployment currently shares one Agent runtime login. Conversation state is isolated,
44
+ but Kintio is not yet a multi-tenant platform where each chat user supplies independent
45
+ Agent credentials, quotas, or working directories.
46
+
47
+ ## Current adapters
48
+
49
+ | Adapter | Inbound | Outbound | Transport | Conversation identity |
50
+ | --- | --- | --- | --- | --- |
51
+ | WeChat KF API | Text and images; other message types become explicit summaries | Text, images, links, Mini Programs, and locations | Public HTTPS callback | `open_kfid + external_userid` |
52
+ | Weixin iLink | Text and images; other message types become explicit summaries | Text and images | Long polling after QR-code binding | `bot_id + user_id` |
53
+
54
+ Adapter capabilities are enforced per conversation. For example, an image received in one
55
+ conversation can only be referenced by the short-lived MCP session bound to that same
56
+ conversation.
57
+
58
+ ## Quick start
59
+
60
+ Prerequisites:
61
+
62
+ - Node.js 24 or later;
63
+ - an installed and authenticated Codex CLI;
64
+ - credentials for at least one supported adapter.
65
+
66
+ ```bash
67
+ npm install --global @kin-tio/cli
68
+ kintio setup
69
+ codex login status
70
+ ```
71
+
72
+ `kintio setup` creates a private instance under `~/.kintio`, installs the bundled Agent
73
+ skill, and writes the channel configuration template. POSIX systems use mode `0600`;
74
+ Windows keeps the instance inside the current user's profile. No adapter is enabled
75
+ by default. Follow the [setup guide](https://github.com/Gkxie/kintio/blob/master/docs/setup.md)
76
+ and edit `~/.kintio/.env` to configure one adapter:
77
+
78
+ - For WeChat KF API, set its callback token, EncodingAESKey, CorpID, and secret. A temporary
79
+ `WECOM_AUTH_TRIGGER` can authorize the first user without knowing their
80
+ `external_userid` in advance.
81
+ - For an existing Weixin iLink binding, set `ILINK_ENABLED=true`. Creating a new binding
82
+ currently starts from an authorized WeChat KF conversation.
83
+
84
+ Start Kintio:
85
+
86
+ ```bash
87
+ kintio start
88
+ kintio status
89
+ kintio logs --lines 100
90
+ ```
91
+
92
+ After startup, confirm that `kintio logs` contains `Hono server is listening on port 8888`.
93
+ Complete the callback or binding checks described in the setup guide before sending traffic.
94
+ Use `kintio run` when a foreground process is preferable to the native daemon.
95
+ Existing source-based deployments can keep their current state after the one-time
96
+ process-manager migration described in the setup guide.
97
+
98
+ Source builds and contributor setup are documented in
99
+ [CONTRIBUTING.md](https://github.com/Gkxie/kintio/blob/master/CONTRIBUTING.md).
100
+
101
+ ## Security boundaries
102
+
103
+ - `.env`, SQLite databases, downloaded media, and local key files are ignored by Git and
104
+ must never be force-added.
105
+ - Kintio does not inject messaging-adapter secrets, stable user identifiers, raw media IDs,
106
+ or database paths into the Agent; host Agent credentials remain host-managed.
107
+ - Codex starts MCP over stdio. Kintio uses only a private Unix-domain socket or
108
+ Windows named pipe behind that process boundary, never an MCP TCP port or public
109
+ Hono route; every action still requires a short-lived conversation capability.
110
+ - Project-level Agent capability restrictions are not an operating-system sandbox. Use a
111
+ dedicated system account and additional isolation appropriate to the Agent's real powers.
112
+ - A provider accepting an outbound request does not prove that a client displayed it;
113
+ uncertain outcomes remain explicit to avoid duplicate delivery.
114
+
115
+ See the [security policy](https://github.com/Gkxie/kintio/blob/master/SECURITY.md) for the complete trust boundary and private
116
+ vulnerability-reporting process.
117
+
118
+ ## Documentation and contributing
119
+
120
+ - [Setup guide](https://github.com/Gkxie/kintio/blob/master/docs/setup.md) — configuration through the first Agent reply.
121
+ - [Architecture](https://github.com/Gkxie/kintio/blob/master/docs/architecture.md) — message flow, module boundaries, identity
122
+ isolation, and source entry points.
123
+ - [Roadmap](https://github.com/Gkxie/kintio/blob/master/ROADMAP.md) — long-term direction and `0.x` priorities.
124
+ - [Contributing guide](https://github.com/Gkxie/kintio/blob/master/CONTRIBUTING.md) — where to start and how to validate changes.
125
+ - [Maintainer guide](https://github.com/Gkxie/kintio/blob/master/MAINTAINING.md) — issue, pull request, and release operations.
126
+ - [Code of Conduct](https://github.com/Gkxie/kintio/blob/master/CODE_OF_CONDUCT.md), [Changelog](CHANGELOG.md), and
127
+ [Apache License 2.0](https://github.com/Gkxie/kintio/blob/master/LICENSE).
128
+
129
+ The default verification entry point is:
130
+
131
+ ```bash
132
+ pnpm test
133
+ ```
134
+
135
+ Tests use temporary SQLite databases and simulated provider and Agent boundaries by
136
+ default. They contact real services only when explicit live-test flags, targets, and
137
+ allowlists are supplied.
138
+
139
+ ## Project status
140
+
141
+ Kintio is in the `0.x` stage. It currently ships the two adapters listed above while the
142
+ channel, identity, recovery, and Agent-runtime contracts are stabilized for future
143
+ adapters.
144
+
145
+ The Weixin iLink protocol implementation incorporates work described in
146
+ [THIRD_PARTY_NOTICES](https://github.com/Gkxie/kintio/blob/master/THIRD_PARTY_NOTICES).
147
+
148
+ Kintio is an independent open-source project. It is not affiliated with, authorized by,
149
+ endorsed by, or an official product of Tencent, WeChat, Weixin, or any other channel
150
+ provider.
@@ -0,0 +1,79 @@
1
+ <div align="center">
2
+
3
+ # Kintio
4
+
5
+ **把聊天通道连接到你掌控的 Agent。**
6
+
7
+ [English](README.md) | 简体中文
8
+
9
+ </div>
10
+
11
+ 这是本项目唯一的中文入口。详细文档、贡献流程与版本说明统一以英文维护。
12
+
13
+ 把 Kintio 部署在运行 Agent 的机器上,授权用户就能在微信等受支持的聊天入口中直接下达
14
+ 任务、补充或改变指令,并在原会话中收到结果。Kintio 负责连接聊天与 Agent,同时隔离不同
15
+ 通道的身份、状态和回复能力;当前 Agent Runtime 使用部署主机上已经登录的 Codex CLI。
16
+
17
+ ## 核心能力
18
+
19
+ - 每个适配器身份使用独立 Agent Thread,不跨通道合并身份或历史。
20
+ - 用户补充指令时可以调整正在执行的任务,避免旧指令排队产生过时回复。
21
+ - SQLite Inbox 支持重启恢复,并优先处理实时消息。
22
+ - 应用 Supervisor 统一管理 HTTP 回调、轮询监听和未来长连接通道;Hono 只是 HTTP 适配器,
23
+ 不是进程生命周期入口。
24
+ - MCP 动作只作用于当前会话,不向 Agent 暴露渠道密钥、原始用户标识或数据库路径。
25
+ - 投递结果明确区分已受理、失败和不确定;结果不确定时不会盲目重发。
26
+
27
+ 目前一套部署共享一份 Agent Runtime 登录态,不是每个聊天用户绑定独立 Agent 凭据、额度和
28
+ 工作目录的多租户平台。
29
+
30
+ ## 当前适配器
31
+
32
+ | 适配器 | 接收 | 发送 | 接入方式 |
33
+ | --- | --- | --- | --- |
34
+ | WeChat KF API | 文字、图片;其他类型转为明确摘要 | 文字、图片、链接、小程序、位置 | 公网 HTTPS 回调 |
35
+ | Weixin iLink | 文字、图片;其他类型转为明确摘要 | 文字、图片 | 扫码绑定后长轮询 |
36
+
37
+ ## 最小启动步骤
38
+
39
+ 需要 Node.js 24+、已安装并登录的 Codex CLI,以及至少一个
40
+ 受支持适配器的凭据。
41
+
42
+ ```bash
43
+ npm install --global @kin-tio/cli
44
+ kintio setup
45
+ codex login status
46
+ ```
47
+
48
+ `kintio setup` 会在 `~/.kintio` 创建私有实例目录、安装内置 Agent Skill,并生成渠道配置
49
+ 模板 `.env`。macOS/Linux 使用 `0600`,Windows 则限定在当前用户目录的 ACL
50
+ 边界内。默认不启用任何适配器;请按英文
51
+ [部署指南](https://github.com/Gkxie/kintio/blob/master/docs/setup.md)配置 WeChat KF API,或为已有 Weixin iLink 绑定设置
52
+ `ILINK_ENABLED=true`。
53
+
54
+ ```bash
55
+ kintio start
56
+ kintio status
57
+ kintio logs --lines 100
58
+ ```
59
+
60
+ 启动后应确认 `kintio logs` 包含 `Hono server is listening on port 8888`;投入使用前仍需按
61
+ 部署指南完成回调或绑定验证。需要前台进程时使用 `kintio run`;现有源码目录部署可以在完成
62
+ 部署指南中的一次性进程管理器迁移后,继续使用原数据库和配置。
63
+ 源码构建与贡献者开发环境见英文
64
+ [贡献指南](https://github.com/Gkxie/kintio/blob/master/CONTRIBUTING.md)。
65
+
66
+ ## 英文文档
67
+
68
+ - [Setup guide](https://github.com/Gkxie/kintio/blob/master/docs/setup.md):配置到收到第一条 Agent 回复。
69
+ - [Architecture](https://github.com/Gkxie/kintio/blob/master/docs/architecture.md):消息链路、模块边界与身份隔离。
70
+ - [Roadmap](https://github.com/Gkxie/kintio/blob/master/ROADMAP.md):长期方向和 `0.x` 优先级。
71
+ - [Contributing guide](https://github.com/Gkxie/kintio/blob/master/CONTRIBUTING.md):参与方式与验证要求。
72
+ - [Security policy](https://github.com/Gkxie/kintio/blob/master/SECURITY.md):信任边界与私密漏洞报告。
73
+ - [Changelog](CHANGELOG.md):用户可观察的版本变化。
74
+
75
+ Kintio 处于 `0.x` 阶段,使用 [Apache License 2.0](LICENSE)。Weixin iLink 协议实现所涉及的
76
+ 第三方归属和许可证见 [THIRD_PARTY_NOTICES](THIRD_PARTY_NOTICES)。
77
+
78
+ Kintio 是独立开源项目,与腾讯、微信、Weixin 及其他通道提供方不存在隶属、授权、背书
79
+ 或官方代表关系。
@@ -0,0 +1,31 @@
1
+ Third-Party Notices
2
+ ===================
3
+
4
+ This project includes protocol definitions adapted from and an independently
5
+ rewritten media flow based on @tencent-weixin/openclaw-weixin 2.4.6:
6
+ https://github.com/Tencent/openclaw-weixin
7
+
8
+ Tencent is pleased to support the open source community by making
9
+ openclaw-weixin available.
10
+
11
+ Copyright (C) 2026 Tencent. All rights reserved.
12
+
13
+ openclaw-weixin is licensed under the MIT License:
14
+
15
+ Permission is hereby granted, free of charge, to any person obtaining a copy
16
+ of this software and associated documentation files (the "Software"), to deal
17
+ in the Software without restriction, including without limitation the rights
18
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
19
+ copies of the Software, and to permit persons to whom the Software is
20
+ furnished to do so, subject to the following conditions:
21
+
22
+ The above copyright notice and this permission notice shall be included in all
23
+ copies or substantial portions of the Software.
24
+
25
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
26
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
27
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
28
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
29
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
30
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
31
+ SOFTWARE.
Binary file
package/bin/kintio.js ADDED
@@ -0,0 +1,3 @@
1
+ #!/usr/bin/env node
2
+
3
+ await import('../dist/cli.js');