@kosuke-ai/cli 6.8.0 → 6.9.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.
@@ -28,154 +28,156 @@ import { operation as o26 } from './deploy/run.js';
28
28
  import { operation as o27 } from './deploy/set-model.js';
29
29
  import { operation as o28 } from './github/repositories.js';
30
30
  import { operation as o29 } from './github/status.js';
31
- import { operation as o30 } from './models/list.js';
32
- import { operation as o31 } from './preview/get.js';
33
- import { operation as o32 } from './preview/health.js';
34
- import { operation as o33 } from './preview/reset.js';
35
- import { operation as o34 } from './preview/share-create.js';
36
- import { operation as o35 } from './preview/share-delete.js';
37
- import { operation as o36 } from './preview/share-get.js';
38
- import { operation as o37 } from './preview/shared.js';
39
- import { operation as o38 } from './preview/shared-artifact.js';
40
- import { operation as o39 } from './projects/branches.js';
41
- import { operation as o40 } from './projects/create.js';
42
- import { operation as o41 } from './projects/delete.js';
43
- import { operation as o42 } from './projects/env-vars-add.js';
44
- import { operation as o43 } from './projects/env-vars-remove.js';
45
- import { operation as o44 } from './projects/get.js';
46
- import { operation as o45 } from './projects/labels.js';
47
- import { operation as o46 } from './projects/labels-color.js';
48
- import { operation as o47 } from './projects/labels-delete.js';
49
- import { operation as o48 } from './projects/labels-usage.js';
50
- import { operation as o49 } from './projects/list.js';
51
- import { operation as o50 } from './projects/qa-guide-get.js';
52
- import { operation as o51 } from './projects/qa-guide-set.js';
53
- import { operation as o52 } from './projects/services-add.js';
54
- import { operation as o53 } from './projects/services-list.js';
55
- import { operation as o54 } from './projects/services-remove.js';
56
- import { operation as o55 } from './projects/services-update.js';
57
- import { operation as o56 } from './projects/settings-get.js';
58
- import { operation as o57 } from './projects/settings-import.js';
59
- import { operation as o58 } from './projects/settings-update.js';
60
- import { operation as o59 } from './projects/skills.js';
61
- import { operation as o60 } from './projects/update.js';
62
- import { operation as o61 } from './sessions/activate.js';
63
- import { operation as o62 } from './sessions/all.js';
64
- import { operation as o63 } from './sessions/artifacts-attach.js';
65
- import { operation as o64 } from './sessions/artifacts-get.js';
66
- import { operation as o65 } from './sessions/artifacts-list.js';
67
- import { operation as o66 } from './sessions/comments-add.js';
68
- import { operation as o67 } from './sessions/comments-delete.js';
69
- import { operation as o68 } from './sessions/comments-list.js';
70
- import { operation as o69 } from './sessions/comments-update.js';
71
- import { operation as o70 } from './sessions/create.js';
72
- import { operation as o71 } from './sessions/delete.js';
73
- import { operation as o72 } from './sessions/diff-comments-add.js';
74
- import { operation as o73 } from './sessions/diff-comments-delete.js';
75
- import { operation as o74 } from './sessions/diff-comments-list.js';
76
- import { operation as o75 } from './sessions/diff-comments-update.js';
77
- import { operation as o76 } from './sessions/diff-commits.js';
78
- import { operation as o77 } from './sessions/diff-files.js';
79
- import { operation as o78 } from './sessions/diff-patch.js';
80
- import { operation as o79 } from './sessions/edit-prompt.js';
81
- import { operation as o80 } from './sessions/files-get.js';
82
- import { operation as o81 } from './sessions/files-list.js';
83
- import { operation as o82 } from './sessions/files-write.js';
84
- import { operation as o83 } from './sessions/get.js';
85
- import { operation as o84 } from './sessions/git-commit.js';
86
- import { operation as o85 } from './sessions/git-commit-message.js';
87
- import { operation as o86 } from './sessions/git-push.js';
88
- import { operation as o87 } from './sessions/git-state.js';
89
- import { operation as o88 } from './sessions/jobs-cancel.js';
90
- import { operation as o89 } from './sessions/jobs-get.js';
91
- import { operation as o90 } from './sessions/jobs-list.js';
92
- import { operation as o91 } from './sessions/labels-edit.js';
93
- import { operation as o92 } from './sessions/labels-set.js';
94
- import { operation as o93 } from './sessions/list.js';
95
- import { operation as o94 } from './sessions/mark-read.js';
96
- import { operation as o95 } from './sessions/messages.js';
97
- import { operation as o96 } from './sessions/needs-you.js';
98
- import { operation as o97 } from './sessions/queue-delete.js';
99
- import { operation as o98 } from './sessions/queue-list.js';
100
- import { operation as o99 } from './sessions/queue-move.js';
101
- import { operation as o100 } from './sessions/queue-resume.js';
102
- import { operation as o101 } from './sessions/queue-send.js';
103
- import { operation as o102 } from './sessions/queue-steer.js';
104
- import { operation as o103 } from './sessions/queue-update.js';
105
- import { operation as o104 } from './sessions/runtime-command.js';
106
- import { operation as o105 } from './sessions/search.js';
107
- import { operation as o106 } from './sessions/send.js';
108
- import { operation as o107 } from './sessions/steer.js';
109
- import { operation as o108 } from './sessions/sync.js';
110
- import { operation as o109 } from './sessions/title-generate.js';
111
- import { operation as o110 } from './sessions/update.js';
112
- import { operation as o111 } from './user/auth-token-revoke.js';
113
- import { operation as o112 } from './user/integrations-list.js';
114
- import { operation as o113 } from './user/integrations-remove.js';
115
- import { operation as o114 } from './user/plugins-list.js';
116
- import { operation as o115 } from './user/plugins-update.js';
117
- import { operation as o116 } from './user/profile.js';
118
- import { operation as o117 } from './user/push-devices-register.js';
119
- import { operation as o118 } from './user/push-devices-remove.js';
120
- import { operation as o119 } from './user/skills-create.js';
121
- import { operation as o120 } from './user/skills-delete.js';
122
- import { operation as o121 } from './user/skills-get.js';
123
- import { operation as o122 } from './user/skills-list.js';
124
- import { operation as o123 } from './user/skills-update.js';
125
- import { operation as o124 } from './user/subscriptions-delete.js';
126
- import { operation as o125 } from './user/subscriptions-get.js';
127
- import { operation as o126 } from './user/subscriptions-login-claude-complete.js';
128
- import { operation as o127 } from './user/subscriptions-login-claude-start.js';
129
- import { operation as o128 } from './user/subscriptions-login-codex-complete.js';
130
- import { operation as o129 } from './user/subscriptions-login-codex-start.js';
131
- import { operation as o130 } from './user/subscriptions-logins-delete.js';
132
- import { operation as o131 } from './user/subscriptions-logins-reorder.js';
133
- import { operation as o132 } from './user/subscriptions-set-default-model.js';
134
- import { operation as o133 } from './user/subscriptions-set-key.js';
135
- import { operation as o134 } from './user/subscriptions-usage.js';
136
- import { operation as o135 } from './workspaces/access-status.js';
137
- import { operation as o136 } from './workspaces/ai-provider-get.js';
138
- import { operation as o137 } from './workspaces/ai-provider-logins-reorder.js';
139
- import { operation as o138 } from './workspaces/ai-provider-remove.js';
140
- import { operation as o139 } from './workspaces/ai-provider-set.js';
141
- import { operation as o140 } from './workspaces/ai-provider-usage-claude.js';
142
- import { operation as o141 } from './workspaces/ai-provider-usage-codex.js';
143
- import { operation as o142 } from './workspaces/ai-provider-usage-coding-plan.js';
144
- import { operation as o143 } from './workspaces/ai-provider-usage-deepseek.js';
145
- import { operation as o144 } from './workspaces/ai-provider-usage-kimi-code.js';
146
- import { operation as o145 } from './workspaces/artifacts.js';
147
- import { operation as o146 } from './workspaces/credits.js';
148
- import { operation as o147 } from './workspaces/get.js';
149
- import { operation as o148 } from './workspaces/getting-started-get.js';
150
- import { operation as o149 } from './workspaces/getting-started-update.js';
151
- import { operation as o150 } from './workspaces/integrations-get.js';
152
- import { operation as o151 } from './workspaces/integrations-list.js';
153
- import { operation as o152 } from './workspaces/integrations-remove.js';
154
- import { operation as o153 } from './workspaces/integrations-slack-get.js';
155
- import { operation as o154 } from './workspaces/lead-cards.js';
156
- import { operation as o155 } from './workspaces/lead-merge.js';
157
- import { operation as o156 } from './workspaces/lead-notifications-open.js';
158
- import { operation as o157 } from './workspaces/lead-proposals-create.js';
159
- import { operation as o158 } from './workspaces/lead-review-request.js';
160
- import { operation as o159 } from './workspaces/lead-session-send.js';
161
- import { operation as o160 } from './workspaces/lead-triage.js';
162
- import { operation as o161 } from './workspaces/list.js';
163
- import { operation as o162 } from './workspaces/members.js';
164
- import { operation as o163 } from './workspaces/plugins-list.js';
165
- import { operation as o164 } from './workspaces/plugins-update.js';
166
- import { operation as o165 } from './workspaces/provider-login-claude-complete.js';
167
- import { operation as o166 } from './workspaces/provider-login-claude-start.js';
168
- import { operation as o167 } from './workspaces/provider-login-codex-complete.js';
169
- import { operation as o168 } from './workspaces/provider-login-codex-start.js';
170
- import { operation as o169 } from './workspaces/sandbox-limit.js';
171
- import { operation as o170 } from './workspaces/skills-create.js';
172
- import { operation as o171 } from './workspaces/skills-delete.js';
173
- import { operation as o172 } from './workspaces/skills-get.js';
174
- import { operation as o173 } from './workspaces/skills-list.js';
175
- import { operation as o174 } from './workspaces/skills-update.js';
176
- import { operation as o175 } from './workspaces/stop-sandboxes.js';
177
- import { operation as o176 } from './workspaces/timezone-set.js';
178
- import { operation as o177 } from './workspaces/usage.js';
31
+ import { operation as o30 } from './integrations/execute.js';
32
+ import { operation as o31 } from './integrations/tools.js';
33
+ import { operation as o32 } from './models/list.js';
34
+ import { operation as o33 } from './preview/get.js';
35
+ import { operation as o34 } from './preview/health.js';
36
+ import { operation as o35 } from './preview/reset.js';
37
+ import { operation as o36 } from './preview/share-create.js';
38
+ import { operation as o37 } from './preview/share-delete.js';
39
+ import { operation as o38 } from './preview/share-get.js';
40
+ import { operation as o39 } from './preview/shared.js';
41
+ import { operation as o40 } from './preview/shared-artifact.js';
42
+ import { operation as o41 } from './projects/branches.js';
43
+ import { operation as o42 } from './projects/create.js';
44
+ import { operation as o43 } from './projects/delete.js';
45
+ import { operation as o44 } from './projects/env-vars-add.js';
46
+ import { operation as o45 } from './projects/env-vars-remove.js';
47
+ import { operation as o46 } from './projects/get.js';
48
+ import { operation as o47 } from './projects/labels.js';
49
+ import { operation as o48 } from './projects/labels-color.js';
50
+ import { operation as o49 } from './projects/labels-delete.js';
51
+ import { operation as o50 } from './projects/labels-usage.js';
52
+ import { operation as o51 } from './projects/list.js';
53
+ import { operation as o52 } from './projects/qa-guide-get.js';
54
+ import { operation as o53 } from './projects/qa-guide-set.js';
55
+ import { operation as o54 } from './projects/services-add.js';
56
+ import { operation as o55 } from './projects/services-list.js';
57
+ import { operation as o56 } from './projects/services-remove.js';
58
+ import { operation as o57 } from './projects/services-update.js';
59
+ import { operation as o58 } from './projects/settings-get.js';
60
+ import { operation as o59 } from './projects/settings-import.js';
61
+ import { operation as o60 } from './projects/settings-update.js';
62
+ import { operation as o61 } from './projects/skills.js';
63
+ import { operation as o62 } from './projects/update.js';
64
+ import { operation as o63 } from './sessions/activate.js';
65
+ import { operation as o64 } from './sessions/all.js';
66
+ import { operation as o65 } from './sessions/artifacts-attach.js';
67
+ import { operation as o66 } from './sessions/artifacts-get.js';
68
+ import { operation as o67 } from './sessions/artifacts-list.js';
69
+ import { operation as o68 } from './sessions/comments-add.js';
70
+ import { operation as o69 } from './sessions/comments-delete.js';
71
+ import { operation as o70 } from './sessions/comments-list.js';
72
+ import { operation as o71 } from './sessions/comments-update.js';
73
+ import { operation as o72 } from './sessions/create.js';
74
+ import { operation as o73 } from './sessions/delete.js';
75
+ import { operation as o74 } from './sessions/diff-comments-add.js';
76
+ import { operation as o75 } from './sessions/diff-comments-delete.js';
77
+ import { operation as o76 } from './sessions/diff-comments-list.js';
78
+ import { operation as o77 } from './sessions/diff-comments-update.js';
79
+ import { operation as o78 } from './sessions/diff-commits.js';
80
+ import { operation as o79 } from './sessions/diff-files.js';
81
+ import { operation as o80 } from './sessions/diff-patch.js';
82
+ import { operation as o81 } from './sessions/edit-prompt.js';
83
+ import { operation as o82 } from './sessions/files-get.js';
84
+ import { operation as o83 } from './sessions/files-list.js';
85
+ import { operation as o84 } from './sessions/files-write.js';
86
+ import { operation as o85 } from './sessions/get.js';
87
+ import { operation as o86 } from './sessions/git-commit.js';
88
+ import { operation as o87 } from './sessions/git-commit-message.js';
89
+ import { operation as o88 } from './sessions/git-push.js';
90
+ import { operation as o89 } from './sessions/git-state.js';
91
+ import { operation as o90 } from './sessions/jobs-cancel.js';
92
+ import { operation as o91 } from './sessions/jobs-get.js';
93
+ import { operation as o92 } from './sessions/jobs-list.js';
94
+ import { operation as o93 } from './sessions/labels-edit.js';
95
+ import { operation as o94 } from './sessions/labels-set.js';
96
+ import { operation as o95 } from './sessions/list.js';
97
+ import { operation as o96 } from './sessions/mark-read.js';
98
+ import { operation as o97 } from './sessions/messages.js';
99
+ import { operation as o98 } from './sessions/needs-you.js';
100
+ import { operation as o99 } from './sessions/queue-delete.js';
101
+ import { operation as o100 } from './sessions/queue-list.js';
102
+ import { operation as o101 } from './sessions/queue-move.js';
103
+ import { operation as o102 } from './sessions/queue-resume.js';
104
+ import { operation as o103 } from './sessions/queue-send.js';
105
+ import { operation as o104 } from './sessions/queue-steer.js';
106
+ import { operation as o105 } from './sessions/queue-update.js';
107
+ import { operation as o106 } from './sessions/runtime-command.js';
108
+ import { operation as o107 } from './sessions/search.js';
109
+ import { operation as o108 } from './sessions/send.js';
110
+ import { operation as o109 } from './sessions/steer.js';
111
+ import { operation as o110 } from './sessions/sync.js';
112
+ import { operation as o111 } from './sessions/title-generate.js';
113
+ import { operation as o112 } from './sessions/update.js';
114
+ import { operation as o113 } from './user/auth-token-revoke.js';
115
+ import { operation as o114 } from './user/integrations-list.js';
116
+ import { operation as o115 } from './user/integrations-remove.js';
117
+ import { operation as o116 } from './user/plugins-list.js';
118
+ import { operation as o117 } from './user/plugins-update.js';
119
+ import { operation as o118 } from './user/profile.js';
120
+ import { operation as o119 } from './user/push-devices-register.js';
121
+ import { operation as o120 } from './user/push-devices-remove.js';
122
+ import { operation as o121 } from './user/skills-create.js';
123
+ import { operation as o122 } from './user/skills-delete.js';
124
+ import { operation as o123 } from './user/skills-get.js';
125
+ import { operation as o124 } from './user/skills-list.js';
126
+ import { operation as o125 } from './user/skills-update.js';
127
+ import { operation as o126 } from './user/subscriptions-delete.js';
128
+ import { operation as o127 } from './user/subscriptions-get.js';
129
+ import { operation as o128 } from './user/subscriptions-login-claude-complete.js';
130
+ import { operation as o129 } from './user/subscriptions-login-claude-start.js';
131
+ import { operation as o130 } from './user/subscriptions-login-codex-complete.js';
132
+ import { operation as o131 } from './user/subscriptions-login-codex-start.js';
133
+ import { operation as o132 } from './user/subscriptions-logins-delete.js';
134
+ import { operation as o133 } from './user/subscriptions-logins-reorder.js';
135
+ import { operation as o134 } from './user/subscriptions-set-default-model.js';
136
+ import { operation as o135 } from './user/subscriptions-set-key.js';
137
+ import { operation as o136 } from './user/subscriptions-usage.js';
138
+ import { operation as o137 } from './workspaces/access-status.js';
139
+ import { operation as o138 } from './workspaces/ai-provider-get.js';
140
+ import { operation as o139 } from './workspaces/ai-provider-logins-reorder.js';
141
+ import { operation as o140 } from './workspaces/ai-provider-remove.js';
142
+ import { operation as o141 } from './workspaces/ai-provider-set.js';
143
+ import { operation as o142 } from './workspaces/ai-provider-usage-claude.js';
144
+ import { operation as o143 } from './workspaces/ai-provider-usage-codex.js';
145
+ import { operation as o144 } from './workspaces/ai-provider-usage-coding-plan.js';
146
+ import { operation as o145 } from './workspaces/ai-provider-usage-deepseek.js';
147
+ import { operation as o146 } from './workspaces/ai-provider-usage-kimi-code.js';
148
+ import { operation as o147 } from './workspaces/artifacts.js';
149
+ import { operation as o148 } from './workspaces/credits.js';
150
+ import { operation as o149 } from './workspaces/get.js';
151
+ import { operation as o150 } from './workspaces/getting-started-get.js';
152
+ import { operation as o151 } from './workspaces/getting-started-update.js';
153
+ import { operation as o152 } from './workspaces/integrations-get.js';
154
+ import { operation as o153 } from './workspaces/integrations-list.js';
155
+ import { operation as o154 } from './workspaces/integrations-remove.js';
156
+ import { operation as o155 } from './workspaces/integrations-slack-get.js';
157
+ import { operation as o156 } from './workspaces/lead-cards.js';
158
+ import { operation as o157 } from './workspaces/lead-merge.js';
159
+ import { operation as o158 } from './workspaces/lead-notifications-open.js';
160
+ import { operation as o159 } from './workspaces/lead-proposals-create.js';
161
+ import { operation as o160 } from './workspaces/lead-review-request.js';
162
+ import { operation as o161 } from './workspaces/lead-session-send.js';
163
+ import { operation as o162 } from './workspaces/lead-triage.js';
164
+ import { operation as o163 } from './workspaces/list.js';
165
+ import { operation as o164 } from './workspaces/members.js';
166
+ import { operation as o165 } from './workspaces/plugins-list.js';
167
+ import { operation as o166 } from './workspaces/plugins-update.js';
168
+ import { operation as o167 } from './workspaces/provider-login-claude-complete.js';
169
+ import { operation as o168 } from './workspaces/provider-login-claude-start.js';
170
+ import { operation as o169 } from './workspaces/provider-login-codex-complete.js';
171
+ import { operation as o170 } from './workspaces/provider-login-codex-start.js';
172
+ import { operation as o171 } from './workspaces/sandbox-limit.js';
173
+ import { operation as o172 } from './workspaces/skills-create.js';
174
+ import { operation as o173 } from './workspaces/skills-delete.js';
175
+ import { operation as o174 } from './workspaces/skills-get.js';
176
+ import { operation as o175 } from './workspaces/skills-list.js';
177
+ import { operation as o176 } from './workspaces/skills-update.js';
178
+ import { operation as o177 } from './workspaces/stop-sandboxes.js';
179
+ import { operation as o178 } from './workspaces/timezone-set.js';
180
+ import { operation as o179 } from './workspaces/usage.js';
179
181
  export const operations = [
180
182
  o0,
181
183
  o1,
@@ -355,4 +357,6 @@ export const operations = [
355
357
  o175,
356
358
  o176,
357
359
  o177,
360
+ o178,
361
+ o179,
358
362
  ];
@@ -0,0 +1,52 @@
1
+ export const operation = {
2
+ "method": "post",
3
+ "path": "/api/agent-integrations/execute",
4
+ "command": [
5
+ "integrations",
6
+ "execute"
7
+ ],
8
+ "summary": "Run one integration tool. An agent runs it for its own workspace, or on the member’s personal connection when that member started the turn. With an API key, name a workspace you belong to: the call runs only on your own personal connections, and one on a workspace connection is refused. The answer names the connection it ran on, or lists the connections to choose from when the call needs one. A tool failure answers 200 with isError true. A Connector Token or a browser session is refused.",
9
+ "pathParams": [],
10
+ "query": [
11
+ {
12
+ "name": "workspace",
13
+ "flag": "workspace",
14
+ "kind": "string",
15
+ "required": false,
16
+ "description": "The workspace the call is made in. Required with an API key, which is refused with 403 when you are not a member of it. An agent credential reaches its own workspace and refuses another."
17
+ }
18
+ ],
19
+ "body": {
20
+ "fields": [
21
+ {
22
+ "name": "name",
23
+ "flag": "name",
24
+ "kind": "string",
25
+ "required": true,
26
+ "description": "The tool to run, as the tools list names it."
27
+ },
28
+ {
29
+ "name": "arguments",
30
+ "flag": "arguments",
31
+ "kind": "json",
32
+ "required": true,
33
+ "description": "The tool's arguments, as its input schema describes them."
34
+ },
35
+ {
36
+ "name": "account",
37
+ "flag": "account",
38
+ "kind": "string",
39
+ "required": false,
40
+ "description": "The connection to run on: its short id, its alias such as notion-personal, or scope:label. Needed when several can run the tool."
41
+ }
42
+ ],
43
+ "required": true
44
+ },
45
+ "multipart": null,
46
+ "attachments": false,
47
+ "anonymous": false,
48
+ "sandboxToken": true,
49
+ "orchestratorToken": false,
50
+ "cronToken": true,
51
+ "leadToken": true
52
+ };
@@ -0,0 +1,73 @@
1
+ export const operation = {
2
+ "method": "get",
3
+ "path": "/api/agent-integrations/tools",
4
+ "command": [
5
+ "integrations",
6
+ "tools"
7
+ ],
8
+ "summary": "List the integration tools you can run now, with the connections that run them. An agent reads its own workspace. With an API key, name a workspace you belong to: it shows that workspace’s connections and your own personal ones. A Connector Token or a browser session is refused.",
9
+ "pathParams": [],
10
+ "query": [
11
+ {
12
+ "name": "workspace",
13
+ "flag": "workspace",
14
+ "kind": "string",
15
+ "required": false,
16
+ "description": "The workspace to list for. Required with an API key, which is refused with 403 when you are not a member of it. An agent credential reaches its own workspace and refuses another."
17
+ },
18
+ {
19
+ "name": "view",
20
+ "flag": "view",
21
+ "kind": "string",
22
+ "required": false,
23
+ "description": "overview: the connections per toolkit with tool counts, and the matching tools once toolkit or search is set. summary: tool names and short descriptions, cut at 300. Without it, full definitions cut at a size budget, which is what older clients read.",
24
+ "choices": [
25
+ "summary",
26
+ "overview"
27
+ ]
28
+ },
29
+ {
30
+ "name": "toolkit",
31
+ "flag": "toolkit",
32
+ "kind": "string",
33
+ "required": false,
34
+ "description": "Only this toolkit, by slug, such as gmail."
35
+ },
36
+ {
37
+ "name": "search",
38
+ "flag": "search",
39
+ "kind": "string",
40
+ "required": false,
41
+ "description": "Only tools whose name, description or toolkit contains this text, in any case."
42
+ },
43
+ {
44
+ "name": "name",
45
+ "flag": "name",
46
+ "kind": "string",
47
+ "required": false,
48
+ "description": "One tool by exact name, with its full input schema. 404 when you are not offered it."
49
+ },
50
+ {
51
+ "name": "account",
52
+ "flag": "account",
53
+ "kind": "string",
54
+ "required": false,
55
+ "description": "Only one connection: its short id, its alias such as notion-personal, or scope:label. Needed for a name that several connections can run."
56
+ },
57
+ {
58
+ "name": "limit",
59
+ "flag": "limit",
60
+ "kind": "integer",
61
+ "required": false,
62
+ "description": "With view overview, how many tools to list when toolkit or search is set. 40 by default."
63
+ }
64
+ ],
65
+ "body": null,
66
+ "multipart": null,
67
+ "attachments": false,
68
+ "anonymous": false,
69
+ "sandboxToken": true,
70
+ "orchestratorToken": false,
71
+ "cronToken": true,
72
+ "leadToken": true
73
+ };
@@ -0,0 +1,135 @@
1
+ import { ResponseTooLarge } from '../runtime/client.js';
2
+ /**
3
+ * The integration tools routes, read the way a command prints them. Everything
4
+ * the platform sends is text from a connected third party or a user's label, so
5
+ * it is flattened to bounded one-liners here and never interpreted.
6
+ */
7
+ export const TOOLS_PATH = '/api/agent-integrations/tools';
8
+ const UNAVAILABLE = 'Integration tools are temporarily unavailable.';
9
+ const TOO_LARGE = 'The platform answer was too large to read. Narrow the request.';
10
+ const TIMED_OUT = 'The platform did not answer in time.';
11
+ /** A write may have landed before the connection failed; a retry could repeat it. */
12
+ const UNKNOWN_OUTCOME = 'The integration tool call did not complete and its outcome is unknown. Do not retry it; read the current state first.';
13
+ export const isRow = (value) => typeof value === 'object' && value !== null && !Array.isArray(value);
14
+ export const rowsOf = (value) => (Array.isArray(value) ? value.filter(isRow) : []);
15
+ /** One bounded line: control characters and runs of space become one space. */
16
+ export function oneLine(value, max) {
17
+ if (typeof value !== 'string')
18
+ return '';
19
+ const flat = value.replace(/[\p{Cc}\p{Cf}\s]+/gu, ' ').trim();
20
+ return flat.length > max ? `${flat.slice(0, max - 1).trimEnd()}…` : flat;
21
+ }
22
+ const count = (value) => typeof value === 'number' && Number.isFinite(value) && value >= 0 ? Math.trunc(value) : 0;
23
+ export function connectionOf(row) {
24
+ const id = oneLine(row.id, 16);
25
+ const alias = oneLine(row.alias, 80);
26
+ if (!alias)
27
+ return null;
28
+ return {
29
+ id,
30
+ alias,
31
+ scope: row.scope === 'personal' ? 'personal' : 'workspace',
32
+ label: oneLine(row.label, 60),
33
+ accountIdentity: oneLine(row.accountIdentity, 80) || null,
34
+ };
35
+ }
36
+ /** `data` of a `view=overview` answer, or null for any other shape (an older platform's). */
37
+ function parseOverview(data) {
38
+ if (!isRow(data) || data.view !== 'overview' || !Array.isArray(data.toolkits))
39
+ return null;
40
+ const toolkits = rowsOf(data.toolkits).map((row) => {
41
+ const tools = isRow(row.tools) ? row.tools : {};
42
+ const toolkit = oneLine(row.toolkit, 64);
43
+ return {
44
+ toolkit,
45
+ name: oneLine(row.name, 60) || toolkit,
46
+ connections: rowsOf(row.connections).flatMap((connection) => connectionOf(connection) ?? []),
47
+ read: count(tools.read),
48
+ write: count(tools.write),
49
+ };
50
+ });
51
+ const tools = Array.isArray(data.tools)
52
+ ? rowsOf(data.tools).map((row) => ({
53
+ name: oneLine(row.name, 80),
54
+ toolkit: oneLine(row.toolkit, 64),
55
+ access: row.access === 'read' ? 'read' : 'write',
56
+ description: oneLine(row.description, 160),
57
+ aliases: (Array.isArray(row.aliases) ? row.aliases : [])
58
+ .map((alias) => oneLine(alias, 80))
59
+ .filter(Boolean),
60
+ }))
61
+ : null;
62
+ return {
63
+ toolkits,
64
+ connectionTotal: count(data.connectionTotal),
65
+ tools,
66
+ toolTotal: tools ? count(data.toolTotal) : null,
67
+ note: oneLine(data.note, 400) || null,
68
+ };
69
+ }
70
+ /** The platform's own sentence for a refusal, bounded; its status when it said nothing. */
71
+ function sentenceOf(error, status) {
72
+ const said = isRow(error) ? oneLine(error.error, 300) : '';
73
+ return said || `HTTP ${status}`;
74
+ }
75
+ /**
76
+ * Why a request failed, in words the reader can act on. The 4xx sentences are
77
+ * the platform's own (a Connector Token, a workspace the key is not a member of,
78
+ * Slack triage); only 401 and 429 are worded here.
79
+ */
80
+ export function failureOf(status, error, method) {
81
+ // A gateway answering for the app does not prove the app never ran the write.
82
+ if (method === 'POST' && (status === 502 || status === 504)) {
83
+ return { ok: false, status, message: UNKNOWN_OUTCOME };
84
+ }
85
+ if (status === 401) {
86
+ return {
87
+ ok: false,
88
+ status,
89
+ message: 'The API key was refused (HTTP 401). Run `kosuke auth status`.',
90
+ };
91
+ }
92
+ if (status === 429) {
93
+ return { ok: false, status, message: 'Too many requests. Try again shortly.' };
94
+ }
95
+ if (status >= 400 && status < 500) {
96
+ return { ok: false, status, message: sentenceOf(error, status) };
97
+ }
98
+ return { ok: false, status, message: UNAVAILABLE };
99
+ }
100
+ /** A request that never got an answer. */
101
+ export function transportFailure(error, method) {
102
+ const name = error instanceof Error ? error.name : '';
103
+ if (method === 'GET' && error instanceof ResponseTooLarge) {
104
+ return { ok: false, status: null, message: TOO_LARGE };
105
+ }
106
+ const timedOut = name === 'TimeoutError' || name === 'AbortError';
107
+ if (method === 'POST')
108
+ return { ok: false, status: null, message: UNKNOWN_OUTCOME };
109
+ return { ok: false, status: null, message: timedOut ? TIMED_OUT : UNAVAILABLE };
110
+ }
111
+ /** The overview view: the connections per toolkit, and the matching tools once a filter is set. */
112
+ export async function readOverview(client, query, signal) {
113
+ const params = { view: 'overview', ...query };
114
+ try {
115
+ const { data, error, response } = await client.GET(TOOLS_PATH, {
116
+ params: { query: params },
117
+ signal,
118
+ });
119
+ if (!response.ok)
120
+ return failureOf(response.status, error, 'GET');
121
+ const raw = isRow(data) ? data.data : undefined;
122
+ const overview = parseOverview(raw);
123
+ if (!overview) {
124
+ return {
125
+ ok: false,
126
+ status: response.status,
127
+ message: 'This platform does not offer the integrations overview yet.',
128
+ };
129
+ }
130
+ return { ok: true, overview, raw };
131
+ }
132
+ catch (error) {
133
+ return transportFailure(error, 'GET');
134
+ }
135
+ }
@@ -0,0 +1,52 @@
1
+ /**
2
+ * `kosuke integrations list` as text: a block per toolkit, with its connections
3
+ * and tool counts, then the matching tools when a filter is set. A cut is never
4
+ * silent: the server's note is printed whenever it sent one.
5
+ */
6
+ const plural = (count, noun) => `${count} ${noun}${count === 1 ? '' : 's'}`;
7
+ function connectionLine(connection) {
8
+ const identity = connection.accountIdentity ?? 'account unknown';
9
+ const id = connection.id ? `, id ${connection.id}` : '';
10
+ return `${connection.alias}: ${connection.scope}, "${connection.label}", ${identity}${id}`;
11
+ }
12
+ function toolLine(tool, width) {
13
+ const access = (tool.access === 'read' ? '[read-only]' : '[writes]').padEnd(11);
14
+ const accounts = tool.aliases.length > 0 ? ` [account: ${tool.aliases.join(', ')}]` : '';
15
+ return `${tool.name.padEnd(width)} ${access} ${tool.description}${accounts}`.trimEnd();
16
+ }
17
+ export function renderOverview(overview, filtered) {
18
+ const { toolkits, tools, note } = overview;
19
+ if (toolkits.length === 0 && overview.connectionTotal === 0) {
20
+ return filtered ? 'No connected tool matches.\n' : 'No integrations are connected.\n';
21
+ }
22
+ if (filtered && tools?.length === 0)
23
+ return 'No connected tool matches.\n';
24
+ const width = Math.max(0, ...(tools ?? []).map((tool) => tool.name.length));
25
+ const blocks = toolkits.map((toolkit) => {
26
+ const lines = [
27
+ `${toolkit.name} (${toolkit.toolkit}): ${toolkit.read} read, ${toolkit.write} write tools`,
28
+ ...toolkit.connections.map((connection) => ` ${connectionLine(connection)}`),
29
+ ];
30
+ const own = (tools ?? []).filter((tool) => tool.toolkit === toolkit.toolkit);
31
+ if (own.length > 0) {
32
+ lines.push(' tools:', ...own.map((tool) => ` ${toolLine(tool, width)}`));
33
+ }
34
+ return lines.join('\n');
35
+ });
36
+ const out = [blocks.join('\n\n')];
37
+ if (tools) {
38
+ out.push(`${tools.length} of ${plural(overview.toolTotal ?? tools.length, 'tool')} shown.`);
39
+ }
40
+ else {
41
+ out.push(`${plural(overview.connectionTotal, 'connection')}. ` +
42
+ "`kosuke integrations list --toolkit <slug>` shows a toolkit's tools; " +
43
+ "`kosuke integrations describe <tool>` prints one tool's input schema.");
44
+ }
45
+ if (note)
46
+ out.push(note);
47
+ return `${out.join('\n\n')}\n`;
48
+ }
49
+ /** One connection per line, for a refusal that asks the caller to pick one. */
50
+ export function choiceLines(choices) {
51
+ return choices.map((choice) => ` ${connectionLine(choice)}`).join('\n');
52
+ }