tinker-agent 1.0.65 → 1.2.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 (208) hide show
  1. package/CHANGELOG.md +36 -0
  2. package/LICENSE +201 -0
  3. package/NOTICE +6 -0
  4. package/README.md +90 -9
  5. package/bin/tinker.js +39 -0
  6. package/node_modules/ansi-regex/index.d.ts +33 -0
  7. package/node_modules/ansi-regex/index.js +14 -0
  8. package/node_modules/ansi-regex/license +9 -0
  9. package/node_modules/ansi-regex/package.json +61 -0
  10. package/node_modules/ansi-regex/readme.md +66 -0
  11. package/node_modules/ansi-styles/index.d.ts +236 -0
  12. package/node_modules/ansi-styles/index.js +223 -0
  13. package/node_modules/ansi-styles/license +9 -0
  14. package/node_modules/ansi-styles/package.json +54 -0
  15. package/node_modules/ansi-styles/readme.md +173 -0
  16. package/node_modules/chalk/license +9 -0
  17. package/node_modules/chalk/package.json +83 -0
  18. package/node_modules/chalk/readme.md +297 -0
  19. package/node_modules/chalk/source/index.d.ts +325 -0
  20. package/node_modules/chalk/source/index.js +225 -0
  21. package/node_modules/chalk/source/utilities.js +33 -0
  22. package/node_modules/chalk/source/vendor/ansi-styles/index.d.ts +236 -0
  23. package/node_modules/chalk/source/vendor/ansi-styles/index.js +223 -0
  24. package/node_modules/chalk/source/vendor/supports-color/browser.d.ts +1 -0
  25. package/node_modules/chalk/source/vendor/supports-color/browser.js +34 -0
  26. package/node_modules/chalk/source/vendor/supports-color/index.d.ts +55 -0
  27. package/node_modules/chalk/source/vendor/supports-color/index.js +190 -0
  28. package/node_modules/character-entities/index.d.ts +6 -0
  29. package/node_modules/character-entities/index.js +2132 -0
  30. package/node_modules/character-entities/license +22 -0
  31. package/node_modules/character-entities/package.json +78 -0
  32. package/node_modules/character-entities/readme.md +152 -0
  33. package/node_modules/decode-named-character-reference/index.d.ts +13 -0
  34. package/node_modules/decode-named-character-reference/index.d.ts.map +1 -0
  35. package/node_modules/decode-named-character-reference/index.dom.d.ts +6 -0
  36. package/node_modules/decode-named-character-reference/index.dom.d.ts.map +1 -0
  37. package/node_modules/decode-named-character-reference/index.dom.js +32 -0
  38. package/node_modules/decode-named-character-reference/index.js +19 -0
  39. package/node_modules/decode-named-character-reference/license +22 -0
  40. package/node_modules/decode-named-character-reference/package.json +90 -0
  41. package/node_modules/decode-named-character-reference/readme.md +136 -0
  42. package/node_modules/get-east-asian-width/index.d.ts +60 -0
  43. package/node_modules/get-east-asian-width/index.js +30 -0
  44. package/node_modules/get-east-asian-width/license +9 -0
  45. package/node_modules/get-east-asian-width/lookup-data.js +21 -0
  46. package/node_modules/get-east-asian-width/lookup.js +138 -0
  47. package/node_modules/get-east-asian-width/package.json +71 -0
  48. package/node_modules/get-east-asian-width/readme.md +65 -0
  49. package/node_modules/get-east-asian-width/utilities.js +24 -0
  50. package/node_modules/has-flag/index.d.ts +39 -0
  51. package/node_modules/has-flag/index.js +8 -0
  52. package/node_modules/has-flag/license +9 -0
  53. package/node_modules/has-flag/package.json +49 -0
  54. package/node_modules/has-flag/readme.md +74 -0
  55. package/node_modules/is-fullwidth-code-point/index.d.ts +17 -0
  56. package/node_modules/is-fullwidth-code-point/index.js +12 -0
  57. package/node_modules/is-fullwidth-code-point/license +9 -0
  58. package/node_modules/is-fullwidth-code-point/package.json +53 -0
  59. package/node_modules/is-fullwidth-code-point/readme.md +31 -0
  60. package/node_modules/markdansi/LICENSE +21 -0
  61. package/node_modules/markdansi/README.md +167 -0
  62. package/node_modules/markdansi/dist/ast.d.ts +99 -0
  63. package/node_modules/markdansi/dist/ast.js +1 -0
  64. package/node_modules/markdansi/dist/cli.d.ts +17 -0
  65. package/node_modules/markdansi/dist/cli.js +208 -0
  66. package/node_modules/markdansi/dist/hyperlink.d.ts +9 -0
  67. package/node_modules/markdansi/dist/hyperlink.js +26 -0
  68. package/node_modules/markdansi/dist/index.d.ts +10 -0
  69. package/node_modules/markdansi/dist/index.js +16 -0
  70. package/node_modules/markdansi/dist/parser.d.ts +2 -0
  71. package/node_modules/markdansi/dist/parser.js +205 -0
  72. package/node_modules/markdansi/dist/render.d.ts +9 -0
  73. package/node_modules/markdansi/dist/render.js +680 -0
  74. package/node_modules/markdansi/dist/stream.d.ts +39 -0
  75. package/node_modules/markdansi/dist/stream.js +192 -0
  76. package/node_modules/markdansi/dist/theme.d.ts +18 -0
  77. package/node_modules/markdansi/dist/theme.js +105 -0
  78. package/node_modules/markdansi/dist/types.d.ts +58 -0
  79. package/node_modules/markdansi/dist/types.js +1 -0
  80. package/node_modules/markdansi/dist/wrap.d.ts +10 -0
  81. package/node_modules/markdansi/dist/wrap.js +73 -0
  82. package/node_modules/markdansi/docs/spec.md +110 -0
  83. package/node_modules/markdansi/package.json +78 -0
  84. package/node_modules/markdansi/tsconfig.json +18 -0
  85. package/node_modules/marked/LICENSE +44 -0
  86. package/node_modules/marked/README.md +115 -0
  87. package/node_modules/marked/bin/main.js +284 -0
  88. package/node_modules/marked/bin/marked.js +16 -0
  89. package/node_modules/marked/lib/marked.d.ts +760 -0
  90. package/node_modules/marked/lib/marked.esm.js +77 -0
  91. package/node_modules/marked/lib/marked.esm.js.map +7 -0
  92. package/node_modules/marked/lib/marked.umd.js +79 -0
  93. package/node_modules/marked/lib/marked.umd.js.map +7 -0
  94. package/node_modules/marked/man/marked.1 +113 -0
  95. package/node_modules/marked/man/marked.1.md +93 -0
  96. package/node_modules/marked/package.json +103 -0
  97. package/node_modules/slice-ansi/index.d.ts +19 -0
  98. package/node_modules/slice-ansi/index.js +317 -0
  99. package/node_modules/slice-ansi/license +10 -0
  100. package/node_modules/slice-ansi/package.json +59 -0
  101. package/node_modules/slice-ansi/readme.md +55 -0
  102. package/node_modules/slice-ansi/tokenize-ansi.js +752 -0
  103. package/node_modules/string-width/index.d.ts +39 -0
  104. package/node_modules/string-width/index.js +203 -0
  105. package/node_modules/string-width/license +9 -0
  106. package/node_modules/string-width/package.json +65 -0
  107. package/node_modules/string-width/readme.md +66 -0
  108. package/node_modules/strip-ansi/index.d.ts +15 -0
  109. package/node_modules/strip-ansi/index.js +19 -0
  110. package/node_modules/strip-ansi/license +9 -0
  111. package/node_modules/strip-ansi/package.json +59 -0
  112. package/node_modules/strip-ansi/readme.md +37 -0
  113. package/node_modules/supports-color/browser.d.ts +1 -0
  114. package/node_modules/supports-color/browser.js +35 -0
  115. package/node_modules/supports-color/index.d.ts +55 -0
  116. package/node_modules/supports-color/index.js +202 -0
  117. package/node_modules/supports-color/license +9 -0
  118. package/node_modules/supports-color/package.json +64 -0
  119. package/node_modules/supports-color/readme.md +75 -0
  120. package/node_modules/supports-hyperlinks/browser.js +10 -0
  121. package/node_modules/supports-hyperlinks/index.d.ts +25 -0
  122. package/node_modules/supports-hyperlinks/index.js +163 -0
  123. package/node_modules/supports-hyperlinks/license +10 -0
  124. package/node_modules/supports-hyperlinks/package.json +47 -0
  125. package/node_modules/supports-hyperlinks/readme.md +45 -0
  126. package/package.json +41 -10
  127. package/patches/markdansi@0.3.2.patch +22 -2
  128. package/src/agent/context-builder.ts +24 -10
  129. package/src/agent/context-meter.ts +89 -5
  130. package/src/agent/loop.ts +107 -10
  131. package/src/agent/runtime-session.ts +1437 -82
  132. package/src/agent/session-ledger.ts +169 -29
  133. package/src/agent/types.ts +12 -1
  134. package/src/agent/user-prompt-projection.ts +62 -0
  135. package/src/cli/config.ts +57 -14
  136. package/src/cli/model-profiles.ts +124 -0
  137. package/src/cli/run-runner.ts +4 -1
  138. package/src/cli/tui-runner.tsx +68 -30
  139. package/src/context/compiled-context-hash.ts +1 -1
  140. package/src/context/compiled-context-validator.ts +92 -15
  141. package/src/context/context-automation-policy.ts +121 -0
  142. package/src/context/context-manager.ts +390 -11
  143. package/src/context/context-policy.ts +8 -0
  144. package/src/context/context-protocol-validator.ts +11 -1
  145. package/src/context/context-revision-compiler.ts +190 -27
  146. package/src/context/context-revision.ts +105 -19
  147. package/src/context/context-surface.ts +329 -0
  148. package/src/context/prefix-retirement-planner.ts +570 -0
  149. package/src/context/protocol-frame.ts +30 -3
  150. package/src/context/recall-retirement-contract.ts +27 -0
  151. package/src/context/swap-planner.ts +34 -10
  152. package/src/events/observation-text-log.ts +3 -3
  153. package/src/events/stdout-event-printer.ts +39 -3
  154. package/src/events/types.ts +172 -35
  155. package/src/ids/runtime-id.ts +6 -0
  156. package/src/ids/uuid-v7.ts +7 -0
  157. package/src/image/image-asset-store.ts +319 -0
  158. package/src/image/image-input-policy.ts +14 -0
  159. package/src/image/image-probe.ts +233 -0
  160. package/src/image/image-types.ts +262 -0
  161. package/src/instructions/project-instructions.ts +4 -1
  162. package/src/mcp/mcp-manager.ts +83 -19
  163. package/src/model/fake-model-client.ts +9 -1
  164. package/src/model/input-token-estimator.ts +25 -0
  165. package/src/model/model-client.ts +60 -0
  166. package/src/model/model-request-preflight.ts +1 -0
  167. package/src/model/moonshot-input-token-estimator.ts +107 -0
  168. package/src/model/openai-chat-mapping.ts +77 -1
  169. package/src/model/openai-chat-model-client.ts +389 -59
  170. package/src/model/openai-chat-stream.ts +272 -0
  171. package/src/model/prompt-prefix-hash.ts +2 -4
  172. package/src/model/token-estimator.ts +4 -0
  173. package/src/observation/observation-builder.ts +29 -0
  174. package/src/session/resume-projection.ts +94 -34
  175. package/src/session/session-catalog.ts +4 -4
  176. package/src/session/session-errors.ts +1 -1
  177. package/src/session/session-history-reader.ts +151 -4
  178. package/src/session/session-last-response-reader.ts +189 -0
  179. package/src/session/session-schema.ts +349 -35
  180. package/src/session/session-store.ts +3266 -255
  181. package/src/session/sqlite-session-ledger.ts +9 -4
  182. package/src/skills/skill-catalog.ts +182 -0
  183. package/src/skills/skill-context.ts +364 -0
  184. package/src/skills/skill-loader.ts +779 -0
  185. package/src/skills/skill-tool.ts +297 -0
  186. package/src/tools/edit.ts +51 -64
  187. package/src/tools/ensure-parent-directory.ts +6 -0
  188. package/src/tools/read.ts +2 -2
  189. package/src/tools/recall.ts +43 -40
  190. package/src/tools/registry.ts +24 -3
  191. package/src/tools/ripgrep.ts +3 -2
  192. package/src/tools/types.ts +43 -4
  193. package/src/tools/write.ts +20 -31
  194. package/src/tui/app.tsx +333 -96
  195. package/src/tui/clipboard.ts +5 -0
  196. package/src/tui/components/mcp-panel.tsx +28 -0
  197. package/src/tui/components/prompt-input.tsx +790 -257
  198. package/src/tui/components/skills-panel.tsx +31 -0
  199. package/src/tui/components/timeline.tsx +30 -1
  200. package/src/tui/event-store.ts +85 -2
  201. package/src/tui/file-mention.ts +234 -0
  202. package/src/tui/line-editor.ts +1 -0
  203. package/src/tui/project-slash-commands.ts +229 -0
  204. package/src/tui/prompt-draft.ts +510 -0
  205. package/src/tui/prompt-history.ts +294 -22
  206. package/src/tui/slash-commands.ts +46 -2
  207. package/src/tui/tui-session-controller.ts +110 -48
  208. package/src/tui/workspace-file-search.ts +94 -0
package/CHANGELOG.md ADDED
@@ -0,0 +1,36 @@
1
+ # Changelog
2
+
3
+ All notable user-facing changes to Tinker are documented here. The project follows
4
+ [Semantic Versioning](https://semver.org/).
5
+
6
+ ## [Unreleased]
7
+
8
+ ## [1.2.0] - 2026-07-21
9
+
10
+ ### Added
11
+
12
+ - Ship Bun 1.3.14 as an npm dependency and launch it through the installed `tinker`
13
+ command, so users no longer need a system-wide Bun installation.
14
+ - Ship a verified platform-specific ripgrep binary for Grep and workspace file
15
+ discovery instead of requiring a system-wide `rg` installation.
16
+ - License the project under Apache License 2.0 and preserve the original Infinite
17
+ Context architecture attribution in `NOTICE`.
18
+ - Add CI, release-package verification, community health files, and an npm trusted
19
+ publishing workflow with provenance.
20
+
21
+ ### Changed
22
+
23
+ - Require Node.js 20 or later for the npm-installed launcher.
24
+ - Limit npm package contents to runtime source, license and attribution material,
25
+ and required bundled dependencies.
26
+
27
+ ## [1.1.0] - 2026-07-21
28
+
29
+ ### Added
30
+
31
+ - First formal npm release under the `tinker-agent` package name with the `tinker`
32
+ executable.
33
+
34
+ [Unreleased]: https://github.com/ishowshao/tinker/compare/v1.2.0...HEAD
35
+ [1.2.0]: https://github.com/ishowshao/tinker/releases/tag/v1.2.0
36
+ [1.1.0]: https://www.npmjs.com/package/tinker-agent/v/1.1.0
package/LICENSE ADDED
@@ -0,0 +1,201 @@
1
+ Apache License
2
+ Version 2.0, January 2004
3
+ http://www.apache.org/licenses/
4
+
5
+ TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION
6
+
7
+ 1. Definitions.
8
+
9
+ "License" shall mean the terms and conditions for use, reproduction,
10
+ and distribution as defined by Sections 1 through 9 of this document.
11
+
12
+ "Licensor" shall mean the copyright owner or entity authorized by
13
+ the copyright owner that is granting the License.
14
+
15
+ "Legal Entity" shall mean the union of the acting entity and all
16
+ other entities that control, are controlled by, or are under common
17
+ control with that entity. For the purposes of this definition,
18
+ "control" means (i) the power, direct or indirect, to cause the
19
+ direction or management of such entity, whether by contract or
20
+ otherwise, or (ii) ownership of fifty percent (50%) or more of the
21
+ outstanding shares, or (iii) beneficial ownership of such entity.
22
+
23
+ "You" (or "Your") shall mean an individual or Legal Entity
24
+ exercising permissions granted by this License.
25
+
26
+ "Source" form shall mean the preferred form for making modifications,
27
+ including but not limited to software source code, documentation
28
+ source, and configuration files.
29
+
30
+ "Object" form shall mean any form resulting from mechanical
31
+ transformation or translation of a Source form, including but
32
+ not limited to compiled object code, generated documentation,
33
+ and conversions to other media types.
34
+
35
+ "Work" shall mean the work of authorship, whether in Source or
36
+ Object form, made available under the License, as indicated by a
37
+ copyright notice that is included in or attached to the work
38
+ (an example is provided in the Appendix below).
39
+
40
+ "Derivative Works" shall mean any work, whether in Source or Object
41
+ form, that is based on (or derived from) the Work and for which the
42
+ editorial revisions, annotations, elaborations, or other modifications
43
+ represent, as a whole, an original work of authorship. For the purposes
44
+ of this License, Derivative Works shall not include works that remain
45
+ separable from, or merely link (or bind by name) to the interfaces of,
46
+ the Work and Derivative Works thereof.
47
+
48
+ "Contribution" shall mean any work of authorship, including
49
+ the original version of the Work and any modifications or additions
50
+ to that Work or Derivative Works thereof, that is intentionally
51
+ submitted to Licensor for inclusion in the Work by the copyright owner
52
+ or by an individual or Legal Entity authorized to submit on behalf of
53
+ the copyright owner. For the purposes of this definition, "submitted"
54
+ means any form of electronic, verbal, or written communication sent
55
+ to the Licensor or its representatives, including but not limited to
56
+ communication on electronic mailing lists, source code control systems,
57
+ and issue tracking systems that are managed by, or on behalf of, the
58
+ Licensor for the purpose of discussing and improving the Work, but
59
+ excluding communication that is conspicuously marked or otherwise
60
+ designated in writing by the copyright owner as "Not a Contribution."
61
+
62
+ "Contributor" shall mean Licensor and any individual or Legal Entity
63
+ on behalf of whom a Contribution has been received by Licensor and
64
+ subsequently incorporated within the Work.
65
+
66
+ 2. Grant of Copyright License. Subject to the terms and conditions of
67
+ this License, each Contributor hereby grants to You a perpetual,
68
+ worldwide, non-exclusive, no-charge, royalty-free, irrevocable
69
+ copyright license to reproduce, prepare Derivative Works of,
70
+ publicly display, publicly perform, sublicense, and distribute the
71
+ Work and such Derivative Works in Source or Object form.
72
+
73
+ 3. Grant of Patent License. Subject to the terms and conditions of
74
+ this License, each Contributor hereby grants to You a perpetual,
75
+ worldwide, non-exclusive, no-charge, royalty-free, irrevocable
76
+ (except as stated in this section) patent license to make, have made,
77
+ use, offer to sell, sell, import, and otherwise transfer the Work,
78
+ where such license applies only to those patent claims licensable
79
+ by such Contributor that are necessarily infringed by their
80
+ Contribution(s) alone or by combination of their Contribution(s)
81
+ with the Work to which such Contribution(s) was submitted. If You
82
+ institute patent litigation against any entity (including a
83
+ cross-claim or counterclaim in a lawsuit) alleging that the Work
84
+ or a Contribution incorporated within the Work constitutes direct
85
+ or contributory patent infringement, then any patent licenses
86
+ granted to You under this License for that Work shall terminate
87
+ as of the date such litigation is filed.
88
+
89
+ 4. Redistribution. You may reproduce and distribute copies of the
90
+ Work or Derivative Works thereof in any medium, with or without
91
+ modifications, and in Source or Object form, provided that You
92
+ meet the following conditions:
93
+
94
+ (a) You must give any other recipients of the Work or
95
+ Derivative Works a copy of this License; and
96
+
97
+ (b) You must cause any modified files to carry prominent notices
98
+ stating that You changed the files; and
99
+
100
+ (c) You must retain, in the Source form of any Derivative Works
101
+ that You distribute, all copyright, patent, trademark, and
102
+ attribution notices from the Source form of the Work,
103
+ excluding those notices that do not pertain to any part of
104
+ the Derivative Works; and
105
+
106
+ (d) If the Work includes a "NOTICE" text file as part of its
107
+ distribution, then any Derivative Works that You distribute must
108
+ include a readable copy of the attribution notices contained
109
+ within such NOTICE file, excluding those notices that do not
110
+ pertain to any part of the Derivative Works, in at least one
111
+ of the following places: within a NOTICE text file distributed
112
+ as part of the Derivative Works; within the Source form or
113
+ documentation, if provided along with the Derivative Works; or,
114
+ within a display generated by the Derivative Works, if and
115
+ wherever such third-party notices normally appear. The contents
116
+ of the NOTICE file are for informational purposes only and
117
+ do not modify the License. You may add Your own attribution
118
+ notices within Derivative Works that You distribute, alongside
119
+ or as an addendum to the NOTICE text from the Work, provided
120
+ that such additional attribution notices cannot be construed
121
+ as modifying the License.
122
+
123
+ You may add Your own copyright statement to Your modifications and
124
+ may provide additional or different license terms and conditions
125
+ for use, reproduction, or distribution of Your modifications, or
126
+ for any such Derivative Works as a whole, provided Your use,
127
+ reproduction, and distribution of the Work otherwise complies with
128
+ the conditions stated in this License.
129
+
130
+ 5. Submission of Contributions. Unless You explicitly state otherwise,
131
+ any Contribution intentionally submitted for inclusion in the Work
132
+ by You to the Licensor shall be under the terms and conditions of
133
+ this License, without any additional terms or conditions.
134
+ Notwithstanding the above, nothing herein shall supersede or modify
135
+ the terms of any separate license agreement you may have executed
136
+ with Licensor regarding such Contributions.
137
+
138
+ 6. Trademarks. This License does not grant permission to use the trade
139
+ names, trademarks, service marks, or product names of the Licensor,
140
+ except as required for reasonable and customary use in describing the
141
+ origin of the Work and reproducing the content of the NOTICE file.
142
+
143
+ 7. Disclaimer of Warranty. Unless required by applicable law or
144
+ agreed to in writing, Licensor provides the Work (and each
145
+ Contributor provides its Contributions) on an "AS IS" BASIS,
146
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
147
+ implied, including, without limitation, any warranties or conditions
148
+ of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A
149
+ PARTICULAR PURPOSE. You are solely responsible for determining the
150
+ appropriateness of using or redistributing the Work and assume any
151
+ risks associated with Your exercise of permissions under this License.
152
+
153
+ 8. Limitation of Liability. In no event and under no legal theory,
154
+ whether in tort (including negligence), contract, or otherwise,
155
+ unless required by applicable law (such as deliberate and grossly
156
+ negligent acts) or agreed to in writing, shall any Contributor be
157
+ liable to You for damages, including any direct, indirect, special,
158
+ incidental, or consequential damages of any character arising as a
159
+ result of this License or out of the use or inability to use the
160
+ Work (including but not limited to damages for loss of goodwill,
161
+ work stoppage, computer failure or malfunction, or any and all
162
+ other commercial damages or losses), even if such Contributor
163
+ has been advised of the possibility of such damages.
164
+
165
+ 9. Accepting Warranty or Additional Liability. While redistributing
166
+ the Work or Derivative Works thereof, You may choose to offer,
167
+ and charge a fee for, acceptance of support, warranty, indemnity,
168
+ or other liability obligations and/or rights consistent with this
169
+ License. However, in accepting such obligations, You may act only
170
+ on Your own behalf and on Your sole responsibility, not on behalf
171
+ of any other Contributor, and only if You agree to indemnify,
172
+ defend, and hold each Contributor harmless for any liability
173
+ incurred by, or claims asserted against, such Contributor by reason
174
+ of your accepting any such warranty or additional liability.
175
+
176
+ END OF TERMS AND CONDITIONS
177
+
178
+ APPENDIX: How to apply the Apache License to your work.
179
+
180
+ To apply the Apache License to your work, attach the following
181
+ boilerplate notice, with the fields enclosed by brackets "[]"
182
+ replaced with your own identifying information. (Don't include
183
+ the brackets!) The text should be enclosed in the appropriate
184
+ comment syntax for the file format. We also recommend that a
185
+ file or class name and description of purpose be included on the
186
+ same "printed page" as the copyright notice for easier
187
+ identification within third-party archives.
188
+
189
+ Copyright 2026 ishowshao
190
+
191
+ Licensed under the Apache License, Version 2.0 (the "License");
192
+ you may not use this file except in compliance with the License.
193
+ You may obtain a copy of the License at
194
+
195
+ http://www.apache.org/licenses/LICENSE-2.0
196
+
197
+ Unless required by applicable law or agreed to in writing, software
198
+ distributed under the License is distributed on an "AS IS" BASIS,
199
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
200
+ See the License for the specific language governing permissions and
201
+ limitations under the License.
package/NOTICE ADDED
@@ -0,0 +1,6 @@
1
+ Tinker
2
+ Copyright 2026 ishowshao
3
+
4
+ The original Tinker Infinite Context architecture and its initial
5
+ implementation were designed and developed by ishowshao as part of the
6
+ Tinker project: https://github.com/ishowshao/tinker
package/README.md CHANGED
@@ -16,41 +16,75 @@ Built with [Bun](https://bun.sh) + TypeScript ESM, powered by [Ink](https://gith
16
16
  - `WebSearch` — Search the web via Exa API
17
17
  - `WebFetch` — Fetch and refine web page content (local, browser, or Exa backend)
18
18
  - `Recall` — Search or retrieve model-visible history from the current session
19
+ - **Agent Skills**: Discover compatible `SKILL.md` packages at project and user
20
+ scope, disclose their catalog progressively, and keep activated instructions
21
+ durable across context compaction and session resume.
19
22
  - **MCP integration**: Connect external [Model Context Protocol](https://modelcontextprotocol.io) servers — their tools are dynamically registered as `mcp__<server>__<tool>`.
20
23
  - **Session persistence**: Sessions are persisted via SQLite, supporting session resume, history recall, and a catalog to browse and switch between sessions.
21
24
  - **Observation system**: Tool execution results are formatted into structured text that the model sees, with separate raw results for event logs and TUI display.
22
25
  - **Turn cancellation**: Users can cancel an ongoing turn safely, with protocol-safe synthetic tool messages.
23
26
  - **Context metering**: Budget-aware context management with protocol validation before sending requests to the model.
24
27
  - **Deterministic context compaction**: Idle sessions can swap eligible historical tool output into Recall-addressable placeholders without calling the model.
28
+ - **Infinite Context architecture**: Immutable canonical history, deterministic
29
+ context revisions, Recall-addressable cold state, and qualified prefix retirement
30
+ keep long-running sessions recoverable without pretending the model has infinite
31
+ tokens. See the [technical design](docs/infinite-context-technical-design-a.md).
25
32
  - **Choice of models**: Supports any OpenAI-compatible API (defaults to DeepSeek). Configurable via environment variables.
26
33
 
27
34
  ## Quick Start
28
35
 
29
36
  ```bash
30
- # Clone and install
31
- git clone <repo>
32
- cd tinker
33
- bun install
37
+ npm install --global tinker-agent
34
38
 
35
39
  # Start the interactive TUI
36
- bun run tinker
40
+ tinker
37
41
 
38
42
  # Run a one-shot prompt
39
- bun run tinker run "explain the project structure"
43
+ tinker run "explain the project structure"
40
44
  ```
41
45
 
46
+ The npm package includes its own Bun runtime. To run Tinker from a source checkout,
47
+ install Bun 1.3 or later, then use `bun install` followed by `bun run tinker`.
48
+
42
49
  ### Slash Commands
43
50
 
44
51
  - `/view <path>` — Open a readable UTF-8 text file in a full-window viewer. Relative
45
52
  paths must remain inside the workspace; absolute paths may point outside it. Use
46
53
  the keyboard or mouse wheel to scroll and press `Esc` to close the viewer.
54
+ - `/copy` — Copy the current session's last completed assistant response to the
55
+ system clipboard as raw Markdown.
47
56
  - `/status` — Show session and context details.
48
- - `/compact` — Deterministically compact eligible historical tool output while the session is idle.
57
+ - `/skills` — Show available skills, their scope and active state, plus user skills
58
+ shadowed by a project skill.
59
+ - `/compact` — Deterministically compact eligible historical tool output while the
60
+ session is idle.
61
+ - `/compact retire` — Retire a complete cold history prefix from the active request;
62
+ the original history remains available through `Recall`.
49
63
  - `/model [profile-name]` — Choose a model profile for a new session.
50
64
  - `/resume [session-id]` — Choose or directly resume a stored session.
51
65
  - `/session delete <session-id> --confirm` — Delete a stored session.
52
66
  - `/quit` — Exit the TUI.
53
67
 
68
+ ### Agent Skills
69
+
70
+ Tinker scans `<workspace>/.agents/skills/` and `~/.agents/skills/` once when a new
71
+ or resumed runtime starts. Each direct child skill must contain a strictly valid
72
+ `SKILL.md`; an invalid discovered skill stops activation with a clear error. A
73
+ project skill wins when both scopes define the same name.
74
+
75
+ Only skill names and descriptions are initially exposed to the model. When the
76
+ model selects a matching skill through the conditional `Skill` tool, Tinker sends
77
+ the complete snapshotted `SKILL.md` and a bounded listing of its standard resource
78
+ directories. Relative resource paths are resolved from that skill's directory and
79
+ are read or executed only through Tinker's existing tools. Activated instructions
80
+ remain in the current system surface across later turns and compaction; resume
81
+ rebinds them to the current validated files.
82
+
83
+ Skill content is not local-only after activation: it is sent to the configured
84
+ model provider and persisted in the private session SQLite database, event log,
85
+ and observation log, just like other model-visible file content. `/skills` is
86
+ read-only and does not rescan, install, activate, or remove skills.
87
+
54
88
  ## Configuration
55
89
 
56
90
  Tinker is configured via environment variables:
@@ -117,6 +151,33 @@ longer present or its runtime contract has changed. Older sessions without a
117
151
  stored profile name can resume only when their model name uniquely matches one
118
152
  configured profile.
119
153
 
154
+ ### Project Custom Slash Commands
155
+
156
+ The TUI loads optional project-scoped prompt aliases from `.tinker.json` in the
157
+ workspace root:
158
+
159
+ ```json
160
+ {
161
+ "version": 1,
162
+ "slashCommands": [
163
+ {
164
+ "name": "git-commit-and-push",
165
+ "description": "Commit and push workspace changes",
166
+ "prompt": "Please inspect the workspace changes, create an appropriate commit, and push it."
167
+ }
168
+ ]
169
+ }
170
+ ```
171
+
172
+ Enter `/git-commit-and-push` to submit its configured prompt as an ordinary user
173
+ turn. Built-in slash commands appear first in suggestions, followed by project
174
+ commands in configuration order. Custom commands accept no arguments and cannot
175
+ override built-ins. The optional configuration is loaded once at TUI startup,
176
+ must be valid when present, and has a 1 MiB size limit. It is not loaded by the
177
+ one-shot `tinker run` command. See
178
+ [`docs/project-custom-slash-commands-design.md`](docs/project-custom-slash-commands-design.md)
179
+ for the full contract.
180
+
120
181
  `Read` has a fixed 262144-byte (256 KiB) content limit per call. A successful
121
182
  call always returns the complete requested line range. Use `offset` and `limit`
122
183
  to page through larger files; oversized requests fail instead of returning
@@ -146,6 +207,7 @@ tinker/
146
207
  │ ├── model/ # Model clients (OpenAI-compatible, fake), chat mapping, preflight
147
208
  │ ├── mcp/ # MCP server management, tool executor adapter
148
209
  │ ├── observation/ # Tool result → model-visible text
210
+ │ ├── skills/ # Agent Skills discovery, catalog, activation, and context
149
211
  │ ├── session/ # SQLite session store, catalog, history reader, resume
150
212
  │ ├── events/ # Event sinks, JSONL log, stdout printer
151
213
  │ ├── tui/ # Ink/React UI components, projection store, session controller
@@ -165,9 +227,28 @@ tinker/
165
227
 
166
228
  ## Requirements
167
229
 
168
- - [Bun](https://bun.sh) (developed with Bun 1.x)
230
+ - Node.js 20 or later and npm for the global package installation
231
+ - [Bun](https://bun.sh) 1.3 or later for development from source
169
232
  - A compatible LLM API (defaults to DeepSeek; any OpenAI-compatible API works)
170
233
 
234
+ ## Security
235
+
236
+ Tinker is an agent with permission to read and modify files and run shell commands in
237
+ the selected workspace. Review its configuration and model-provider data policies
238
+ before using it with sensitive source code. Please report vulnerabilities privately
239
+ through [GitHub Security Advisories](https://github.com/ishowshao/tinker/security/advisories/new).
240
+
241
+ ## Contributing
242
+
243
+ Contributions are welcome. See [CONTRIBUTING.md](CONTRIBUTING.md) for the development
244
+ workflow and [CODE_OF_CONDUCT.md](CODE_OF_CONDUCT.md) for community expectations.
245
+
246
+ ## Attribution
247
+
248
+ The original Tinker Infinite Context architecture and its initial implementation were
249
+ designed and developed by **ishowshao**. See [NOTICE](NOTICE) for the attribution that
250
+ accompanies distributions and derivative works.
251
+
171
252
  ## License
172
253
 
173
- MIT
254
+ Licensed under the [Apache License 2.0](LICENSE).
package/bin/tinker.js ADDED
@@ -0,0 +1,39 @@
1
+ #!/usr/bin/env node
2
+
3
+ import { spawnSync } from "node:child_process";
4
+ import { createRequire } from "node:module";
5
+ import { dirname, join } from "node:path";
6
+ import { fileURLToPath } from "node:url";
7
+
8
+ const require = createRequire(import.meta.url);
9
+
10
+ let bunPackageJson;
11
+ try {
12
+ bunPackageJson = require.resolve("bun/package.json");
13
+ } catch {
14
+ process.stderr.write(
15
+ "Tinker could not find its bundled Bun runtime. Reinstall tinker-agent.\n",
16
+ );
17
+ process.exit(1);
18
+ }
19
+
20
+ const bunExecutable = join(dirname(bunPackageJson), "bin", "bun.exe");
21
+ const tinkerEntryPoint = fileURLToPath(
22
+ new URL("../src/cli/index.ts", import.meta.url),
23
+ );
24
+ const result = spawnSync(
25
+ bunExecutable,
26
+ [tinkerEntryPoint, ...process.argv.slice(2)],
27
+ { stdio: "inherit" },
28
+ );
29
+
30
+ if (result.error !== undefined) {
31
+ process.stderr.write(`Tinker failed to start Bun: ${result.error.message}\n`);
32
+ process.exit(1);
33
+ }
34
+
35
+ if (result.signal !== null) {
36
+ process.kill(process.pid, result.signal);
37
+ }
38
+
39
+ process.exit(result.status ?? 1);
@@ -0,0 +1,33 @@
1
+ export type Options = {
2
+ /**
3
+ Match only the first ANSI escape.
4
+
5
+ @default false
6
+ */
7
+ readonly onlyFirst: boolean;
8
+ };
9
+
10
+ /**
11
+ Regular expression for matching ANSI escape codes.
12
+
13
+ @example
14
+ ```
15
+ import ansiRegex from 'ansi-regex';
16
+
17
+ ansiRegex().test('\u001B[4mcake\u001B[0m');
18
+ //=> true
19
+
20
+ ansiRegex().test('cake');
21
+ //=> false
22
+
23
+ '\u001B[4mcake\u001B[0m'.match(ansiRegex());
24
+ //=> ['\u001B[4m', '\u001B[0m']
25
+
26
+ '\u001B[4mcake\u001B[0m'.match(ansiRegex({onlyFirst: true}));
27
+ //=> ['\u001B[4m']
28
+
29
+ '\u001B]8;;https://github.com\u0007click\u001B]8;;\u0007'.match(ansiRegex());
30
+ //=> ['\u001B]8;;https://github.com\u0007', '\u001B]8;;\u0007']
31
+ ```
32
+ */
33
+ export default function ansiRegex(options?: Options): RegExp;
@@ -0,0 +1,14 @@
1
+ export default function ansiRegex({onlyFirst = false} = {}) {
2
+ // Valid string terminator sequences are BEL, ESC\, and 0x9c
3
+ const ST = '(?:\\u0007|\\u001B\\u005C|\\u009C)';
4
+
5
+ // OSC sequences only: ESC ] ... ST (non-greedy until the first ST)
6
+ const osc = `(?:\\u001B\\][\\s\\S]*?${ST})`;
7
+
8
+ // CSI and related: ESC/C1, optional intermediates, optional params (supports ; and :) then final byte
9
+ const csi = '[\\u001B\\u009B][[\\]()#;?]*(?:\\d{1,4}(?:[;:]\\d{0,4})*)?[\\dA-PR-TZcf-nq-uy=><~]';
10
+
11
+ const pattern = `${osc}|${csi}`;
12
+
13
+ return new RegExp(pattern, onlyFirst ? undefined : 'g');
14
+ }
@@ -0,0 +1,9 @@
1
+ MIT License
2
+
3
+ Copyright (c) Sindre Sorhus <sindresorhus@gmail.com> (https://sindresorhus.com)
4
+
5
+ Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:
6
+
7
+ The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.
8
+
9
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
@@ -0,0 +1,61 @@
1
+ {
2
+ "name": "ansi-regex",
3
+ "version": "6.2.2",
4
+ "description": "Regular expression for matching ANSI escape codes",
5
+ "license": "MIT",
6
+ "repository": "chalk/ansi-regex",
7
+ "funding": "https://github.com/chalk/ansi-regex?sponsor=1",
8
+ "author": {
9
+ "name": "Sindre Sorhus",
10
+ "email": "sindresorhus@gmail.com",
11
+ "url": "https://sindresorhus.com"
12
+ },
13
+ "type": "module",
14
+ "exports": "./index.js",
15
+ "types": "./index.d.ts",
16
+ "sideEffects": false,
17
+ "engines": {
18
+ "node": ">=12"
19
+ },
20
+ "scripts": {
21
+ "test": "xo && ava && tsd",
22
+ "view-supported": "node fixtures/view-codes.js"
23
+ },
24
+ "files": [
25
+ "index.js",
26
+ "index.d.ts"
27
+ ],
28
+ "keywords": [
29
+ "ansi",
30
+ "styles",
31
+ "color",
32
+ "colour",
33
+ "colors",
34
+ "terminal",
35
+ "console",
36
+ "cli",
37
+ "string",
38
+ "tty",
39
+ "escape",
40
+ "formatting",
41
+ "rgb",
42
+ "256",
43
+ "shell",
44
+ "xterm",
45
+ "command-line",
46
+ "text",
47
+ "regex",
48
+ "regexp",
49
+ "re",
50
+ "match",
51
+ "test",
52
+ "find",
53
+ "pattern"
54
+ ],
55
+ "devDependencies": {
56
+ "ansi-escapes": "^5.0.0",
57
+ "ava": "^3.15.0",
58
+ "tsd": "^0.21.0",
59
+ "xo": "^0.54.2"
60
+ }
61
+ }
@@ -0,0 +1,66 @@
1
+ # ansi-regex
2
+
3
+ > Regular expression for matching [ANSI escape codes](https://en.wikipedia.org/wiki/ANSI_escape_code)
4
+
5
+ ## Install
6
+
7
+ ```sh
8
+ npm install ansi-regex
9
+ ```
10
+
11
+ ## Usage
12
+
13
+ ```js
14
+ import ansiRegex from 'ansi-regex';
15
+
16
+ ansiRegex().test('\u001B[4mcake\u001B[0m');
17
+ //=> true
18
+
19
+ ansiRegex().test('cake');
20
+ //=> false
21
+
22
+ '\u001B[4mcake\u001B[0m'.match(ansiRegex());
23
+ //=> ['\u001B[4m', '\u001B[0m']
24
+
25
+ '\u001B[4mcake\u001B[0m'.match(ansiRegex({onlyFirst: true}));
26
+ //=> ['\u001B[4m']
27
+
28
+ '\u001B]8;;https://github.com\u0007click\u001B]8;;\u0007'.match(ansiRegex());
29
+ //=> ['\u001B]8;;https://github.com\u0007', '\u001B]8;;\u0007']
30
+ ```
31
+
32
+ ## API
33
+
34
+ ### ansiRegex(options?)
35
+
36
+ Returns a regex for matching ANSI escape codes.
37
+
38
+ #### options
39
+
40
+ Type: `object`
41
+
42
+ ##### onlyFirst
43
+
44
+ Type: `boolean`\
45
+ Default: `false` *(Matches any ANSI escape codes in a string)*
46
+
47
+ Match only the first ANSI escape.
48
+
49
+ ## Important
50
+
51
+ If you run the regex against untrusted user input in a server context, you should [give it a timeout](https://github.com/sindresorhus/super-regex).
52
+
53
+ **I do not consider [ReDoS](https://blog.yossarian.net/2022/12/28/ReDoS-vulnerabilities-and-misaligned-incentives) a valid vulnerability for this package.**
54
+
55
+ ## FAQ
56
+
57
+ ### Why do you test for codes not in the ECMA 48 standard?
58
+
59
+ Some of the codes we run as a test are codes that we acquired finding various lists of non-standard or manufacturer specific codes. We test for both standard and non-standard codes, as most of them follow the same or similar format and can be safely matched in strings without the risk of removing actual string content. There are a few non-standard control codes that do not follow the traditional format (i.e. they end in numbers) thus forcing us to exclude them from the test because we cannot reliably match them.
60
+
61
+ On the historical side, those ECMA standards were established in the early 90's whereas the VT100, for example, was designed in the mid/late 70's. At that point in time, control codes were still pretty ungoverned and engineers used them for a multitude of things, namely to activate hardware ports that may have been proprietary. Somewhere else you see a similar 'anarchy' of codes is in the x86 architecture for processors; there are a ton of "interrupts" that can mean different things on certain brands of processors, most of which have been phased out.
62
+
63
+ ## Maintainers
64
+
65
+ - [Sindre Sorhus](https://github.com/sindresorhus)
66
+ - [Josh Junon](https://github.com/qix-)