ctxr-cli 0.34.0 → 0.35.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 (125) hide show
  1. package/README.md +25 -5
  2. package/dist/commands/plugin-build.d.ts +33 -0
  3. package/dist/commands/plugin-build.d.ts.map +1 -0
  4. package/dist/commands/plugin-build.js +51 -0
  5. package/dist/commands/plugin-build.js.map +1 -0
  6. package/dist/commands/publish-check.d.ts.map +1 -1
  7. package/dist/commands/publish-check.js +35 -4
  8. package/dist/commands/publish-check.js.map +1 -1
  9. package/dist/commands/serve.d.ts.map +1 -1
  10. package/dist/commands/serve.js +10 -2
  11. package/dist/commands/serve.js.map +1 -1
  12. package/dist/commands/session-start.d.ts.map +1 -1
  13. package/dist/commands/session-start.js +12 -38
  14. package/dist/commands/session-start.js.map +1 -1
  15. package/dist/core/fs/atomic.d.ts +3 -2
  16. package/dist/core/fs/atomic.d.ts.map +1 -1
  17. package/dist/core/fs/atomic.js +3 -2
  18. package/dist/core/fs/atomic.js.map +1 -1
  19. package/dist/core/mcp/cli-runner.d.ts +41 -0
  20. package/dist/core/mcp/cli-runner.d.ts.map +1 -0
  21. package/dist/core/mcp/cli-runner.js +81 -0
  22. package/dist/core/mcp/cli-runner.js.map +1 -0
  23. package/dist/core/mcp/jsonrpc.d.ts +13 -1
  24. package/dist/core/mcp/jsonrpc.d.ts.map +1 -1
  25. package/dist/core/mcp/jsonrpc.js +1 -1
  26. package/dist/core/mcp/jsonrpc.js.map +1 -1
  27. package/dist/core/mcp/member-sessions.d.ts +48 -0
  28. package/dist/core/mcp/member-sessions.d.ts.map +1 -0
  29. package/dist/core/mcp/member-sessions.js +85 -0
  30. package/dist/core/mcp/member-sessions.js.map +1 -0
  31. package/dist/core/mcp/ownership.d.ts +51 -0
  32. package/dist/core/mcp/ownership.d.ts.map +1 -0
  33. package/dist/core/mcp/ownership.js +101 -0
  34. package/dist/core/mcp/ownership.js.map +1 -0
  35. package/dist/core/mcp/paths.d.ts +48 -0
  36. package/dist/core/mcp/paths.d.ts.map +1 -0
  37. package/dist/core/mcp/paths.js +111 -0
  38. package/dist/core/mcp/paths.js.map +1 -0
  39. package/dist/core/mcp/sessions.d.ts +24 -46
  40. package/dist/core/mcp/sessions.d.ts.map +1 -1
  41. package/dist/core/mcp/sessions.js +31 -103
  42. package/dist/core/mcp/sessions.js.map +1 -1
  43. package/dist/core/mcp/tool-map.d.ts +94 -0
  44. package/dist/core/mcp/tool-map.d.ts.map +1 -0
  45. package/dist/core/mcp/tool-map.js +211 -0
  46. package/dist/core/mcp/tool-map.js.map +1 -0
  47. package/dist/core/mcp/tools/capture.d.ts +7 -2
  48. package/dist/core/mcp/tools/capture.d.ts.map +1 -1
  49. package/dist/core/mcp/tools/capture.js +69 -18
  50. package/dist/core/mcp/tools/capture.js.map +1 -1
  51. package/dist/core/mcp/tools/cli.d.ts +97 -0
  52. package/dist/core/mcp/tools/cli.d.ts.map +1 -0
  53. package/dist/core/mcp/tools/cli.js +271 -0
  54. package/dist/core/mcp/tools/cli.js.map +1 -0
  55. package/dist/core/mcp/tools/edit.d.ts +62 -28
  56. package/dist/core/mcp/tools/edit.d.ts.map +1 -1
  57. package/dist/core/mcp/tools/edit.js +182 -153
  58. package/dist/core/mcp/tools/edit.js.map +1 -1
  59. package/dist/core/mcp/tools/files.d.ts +37 -11
  60. package/dist/core/mcp/tools/files.d.ts.map +1 -1
  61. package/dist/core/mcp/tools/files.js +122 -100
  62. package/dist/core/mcp/tools/files.js.map +1 -1
  63. package/dist/core/mcp/tools/index.d.ts +12 -3
  64. package/dist/core/mcp/tools/index.d.ts.map +1 -1
  65. package/dist/core/mcp/tools/index.js +161 -58
  66. package/dist/core/mcp/tools/index.js.map +1 -1
  67. package/dist/core/mcp/tools/sessions.d.ts +145 -0
  68. package/dist/core/mcp/tools/sessions.d.ts.map +1 -0
  69. package/dist/core/mcp/tools/sessions.js +226 -0
  70. package/dist/core/mcp/tools/sessions.js.map +1 -0
  71. package/dist/core/plugin/build.d.ts +70 -0
  72. package/dist/core/plugin/build.d.ts.map +1 -0
  73. package/dist/core/plugin/build.js +159 -0
  74. package/dist/core/plugin/build.js.map +1 -0
  75. package/dist/core/plugin/routes.d.ts +35 -0
  76. package/dist/core/plugin/routes.d.ts.map +1 -0
  77. package/dist/core/plugin/routes.js +77 -0
  78. package/dist/core/plugin/routes.js.map +1 -0
  79. package/dist/core/plugin/zip.d.ts +17 -0
  80. package/dist/core/plugin/zip.d.ts.map +1 -0
  81. package/dist/core/plugin/zip.js +75 -0
  82. package/dist/core/plugin/zip.js.map +1 -0
  83. package/dist/core/session/start.d.ts +46 -0
  84. package/dist/core/session/start.d.ts.map +1 -0
  85. package/dist/core/session/start.js +33 -0
  86. package/dist/core/session/start.js.map +1 -0
  87. package/dist/core/skills.d.ts +20 -2
  88. package/dist/core/skills.d.ts.map +1 -1
  89. package/dist/core/skills.js +56 -3
  90. package/dist/core/skills.js.map +1 -1
  91. package/dist/run.d.ts +12 -0
  92. package/dist/run.d.ts.map +1 -1
  93. package/dist/run.js +81 -58
  94. package/dist/run.js.map +1 -1
  95. package/dist/version.d.ts +1 -1
  96. package/dist/version.js +1 -1
  97. package/package.json +1 -1
  98. package/templates/mcp/Delete.md +6 -0
  99. package/templates/mcp/Edit.md +6 -5
  100. package/templates/mcp/Glob.md +2 -2
  101. package/templates/mcp/Grep.md +2 -1
  102. package/templates/mcp/Move.md +7 -0
  103. package/templates/mcp/Read.md +4 -4
  104. package/templates/mcp/Write.md +4 -4
  105. package/templates/mcp/ctxr.md +7 -0
  106. package/templates/mcp/ctxr_write.md +8 -0
  107. package/templates/mcp/server-instructions.md +11 -3
  108. package/templates/mcp/session_discard.md +4 -0
  109. package/templates/mcp/session_list.md +7 -0
  110. package/templates/mcp/session_rebase.md +5 -0
  111. package/templates/mcp/session_start.md +7 -0
  112. package/templates/mcp/session_status.md +3 -0
  113. package/templates/mcp/session_submit.md +8 -0
  114. package/templates/plugin/README.md +13 -0
  115. package/templates/plugin/chatgpt-mcp.json +19 -0
  116. package/templates/plugin/chatgpt-plugin.json +13 -0
  117. package/templates/plugin/claude-mcp.json +8 -0
  118. package/templates/plugin/claude-plugin.json +6 -0
  119. package/templates/plugin/page.html +47 -0
  120. package/templates/skills/ctxr-publish.md +2 -1
  121. package/templates/skills/mcp/_preamble.md +44 -0
  122. package/dist/core/mcp/drafts.d.ts +0 -30
  123. package/dist/core/mcp/drafts.d.ts.map +0 -1
  124. package/dist/core/mcp/drafts.js +0 -52
  125. package/dist/core/mcp/drafts.js.map +0 -1
@@ -1,22 +1,38 @@
1
1
  import { packagedTemplate } from '../../templates.js';
2
- import { asToolRefusal, capture, CAPTURE_INPUT_SCHEMA, parseCaptureArgs } from './capture.js';
3
- import { EDIT_INPUT_SCHEMA, editTool, parseEditArgs, parseWriteArgs, WRITE_INPUT_SCHEMA, writeTool } from './edit.js';
2
+ import { packagedCliEntry } from '../cli-runner.js';
3
+ import { asToolRefusal } from '../sessions.js';
4
+ import { TOOL_REGISTRY } from '../tool-map.js';
5
+ import { capture, CAPTURE_INPUT_SCHEMA, parseCaptureArgs } from './capture.js';
6
+ import { CTXR_INPUT_SCHEMA, CTXR_WRITE_INPUT_SCHEMA, ctxrTool, ctxrWriteTool, parseCliArgs, renderCli } from './cli.js';
7
+ import { DELETE_INPUT_SCHEMA, deleteTool, EDIT_INPUT_SCHEMA, editTool, MOVE_INPUT_SCHEMA, moveTool, parseDeleteArgs, parseEditArgs, parseMoveArgs, parseWriteArgs, WRITE_INPUT_SCHEMA, writeTool, } from './edit.js';
4
8
  import { GLOB_INPUT_SCHEMA, globTool, GREP_INPUT_SCHEMA, grepTool, parseGlobArgs, parseGrepArgs, parseReadArgs, READ_INPUT_SCHEMA, readTool, renderGlob, renderGrep, renderRead, } from './files.js';
5
9
  import { find, FIND_INPUT_SCHEMA, parseFindArgs } from './find.js';
6
10
  import { GATHER_INPUT_SCHEMA, gatherWithBodies, parseGatherArgs } from './gather.js';
11
+ import { SESSION_DISCARD_INPUT_SCHEMA, SESSION_LIST_INPUT_SCHEMA, SESSION_REBASE_INPUT_SCHEMA, SESSION_START_INPUT_SCHEMA, SESSION_STATUS_INPUT_SCHEMA, SESSION_SUBMIT_INPUT_SCHEMA, sessionDiscardTool, sessionListTool, sessionRebaseTool, sessionStartTool, sessionStatusTool, sessionSubmitTool, } from './sessions.js';
7
12
  /**
8
13
  * The remote surface's tool set and the prose that describes it
9
14
  * (templates/mcp/, shipped-prose-lives-in-templates). Built per request from
10
- * the server's current state. Reads go through `view.read`, so each sees one
11
- * commit and names it; writes go through the one mutex (design.md D9, D13).
15
+ * the server's current state. Reads of the served commit go through
16
+ * `view.read`, so each sees one commit and names it; every write goes through
17
+ * the one mutex (serve-the-store-over-mcp design.md D9, D13).
18
+ *
19
+ * serve-the-session-lifecycle-to-chat-apps D8, D9 and revision 6: the
20
+ * registry is `tool-map.ts`'s — this module supplies each listed tool's
21
+ * implementation and annotations, and refuses to build when the two differ.
12
22
  */
13
23
  export function serverInstructions(storeName) {
14
24
  return packagedTemplate('mcp', 'server-instructions').replaceAll('__STORE_NAME__', storeName);
15
25
  }
16
- /** Writes surface a WriteRefusal as a refusal the client model can read. */
17
- async function writing(ctx, fn) {
26
+ /** D8: changes nothing; asking twice answers the same. */
27
+ const READ_ONLY = { readOnlyHint: true, destructiveHint: false, idempotentHint: true, openWorldHint: false };
28
+ /** D8: changes a session or the forge, reviewably: nothing it does is lost or lands without a decision. */
29
+ const WRITES = { readOnlyHint: false, destructiveHint: false, idempotentHint: false, openWorldHint: false };
30
+ /** D8: removes work. */
31
+ const DESTRUCTIVE = { readOnlyHint: false, destructiveHint: true, idempotentHint: false, openWorldHint: false };
32
+ /** A refusal from the core or the write side, readable by the client model; writes one at a time. */
33
+ async function refusing(fn) {
18
34
  try {
19
- return await ctx.mutex.run(fn);
35
+ return await fn();
20
36
  }
21
37
  catch (err) {
22
38
  throw asToolRefusal(err);
@@ -24,106 +40,193 @@ async function writing(ctx, fn) {
24
40
  }
25
41
  export function buildTools(ctx) {
26
42
  const read = (fn) => ctx.view.read(ctx.syncDeps, fn);
27
- return [
28
- {
29
- name: 'find',
43
+ const writing = (fn) => refusing(() => ctx.mutex.run(fn));
44
+ const files = { view: ctx.view, syncDeps: ctx.syncDeps, write: ctx.write };
45
+ const cli = { ...files, entry: ctx.cliEntry ?? packagedCliEntry(), timeoutMs: ctx.cliTimeoutMs };
46
+ const prose = (name) => packagedTemplate('mcp', name);
47
+ const implementations = {
48
+ find: {
30
49
  title: 'Find in the store',
31
- description: packagedTemplate('mcp', 'find'),
50
+ description: prose('find'),
32
51
  inputSchema: FIND_INPUT_SCHEMA,
33
52
  scope: 'read',
34
- readOnly: true,
53
+ annotations: READ_ONLY,
35
54
  run: (args) => {
36
55
  const parsed = parseFindArgs(args);
37
56
  return read((snapshot) => find(snapshot, parsed, ctx.baseUrl));
38
57
  },
39
58
  },
40
- {
41
- name: 'gather',
59
+ gather: {
42
60
  title: 'Gather related notes',
43
- description: packagedTemplate('mcp', 'gather'),
61
+ description: prose('gather'),
44
62
  inputSchema: GATHER_INPUT_SCHEMA,
45
63
  scope: 'read',
46
- readOnly: true,
64
+ annotations: READ_ONLY,
47
65
  run: (args) => {
48
66
  const parsed = parseGatherArgs(args);
49
67
  return read((snapshot) => gatherWithBodies(snapshot, parsed));
50
68
  },
51
69
  },
52
- {
53
- name: 'Read',
70
+ Read: {
54
71
  title: 'Read a file',
55
- description: packagedTemplate('mcp', 'Read'),
72
+ description: prose('Read'),
56
73
  inputSchema: READ_INPUT_SCHEMA,
57
74
  scope: 'read',
58
- readOnly: true,
75
+ annotations: READ_ONLY,
59
76
  render: renderRead,
60
- run: (args, principal) => {
61
- const parsed = parseReadArgs(args);
62
- return read((snapshot) => readTool(snapshot, ctx.write, principal.email, parsed));
63
- },
77
+ run: (args, principal) => refusing(() => readTool(files, principal.email, parseReadArgs(args))),
64
78
  },
65
- {
66
- name: 'Grep',
79
+ Grep: {
67
80
  title: 'Search file contents',
68
- description: packagedTemplate('mcp', 'Grep'),
81
+ description: prose('Grep'),
69
82
  inputSchema: GREP_INPUT_SCHEMA,
70
83
  scope: 'read',
71
- readOnly: true,
84
+ annotations: READ_ONLY,
72
85
  render: renderGrep,
73
- run: (args) => {
74
- const parsed = parseGrepArgs(args);
75
- return read((snapshot) => grepTool(snapshot, parsed));
76
- },
86
+ run: (args, principal) => refusing(() => grepTool(files, principal.email, parseGrepArgs(args))),
77
87
  },
78
- {
79
- name: 'Glob',
88
+ Glob: {
80
89
  title: 'Find files by name',
81
- description: packagedTemplate('mcp', 'Glob'),
90
+ description: prose('Glob'),
82
91
  inputSchema: GLOB_INPUT_SCHEMA,
83
92
  scope: 'read',
84
- readOnly: true,
93
+ annotations: READ_ONLY,
85
94
  render: renderGlob,
86
- run: (args) => {
87
- const parsed = parseGlobArgs(args);
88
- return read((snapshot) => globTool(snapshot, parsed));
89
- },
95
+ run: (args, principal) => refusing(() => globTool(files, principal.email, parseGlobArgs(args))),
90
96
  },
91
- {
92
- name: 'capture',
97
+ capture: {
93
98
  title: 'Capture into the store',
94
- description: packagedTemplate('mcp', 'capture'),
99
+ description: prose('capture'),
95
100
  inputSchema: CAPTURE_INPUT_SCHEMA,
96
101
  scope: 'capture',
97
- readOnly: false,
102
+ annotations: WRITES,
98
103
  run: (args, principal) => {
99
104
  const parsed = parseCaptureArgs(args);
100
- return writing(ctx, () => capture({ view: ctx.view, syncDeps: ctx.syncDeps, write: ctx.write }, principal.email, parsed));
105
+ return writing(() => capture(files, principal.email, parsed));
101
106
  },
102
107
  },
103
- {
104
- name: 'Edit',
105
- title: 'Edit a note',
106
- description: packagedTemplate('mcp', 'Edit'),
108
+ session_start: {
109
+ title: 'Start a session',
110
+ description: prose('session_start'),
111
+ inputSchema: SESSION_START_INPUT_SCHEMA,
112
+ scope: 'edit',
113
+ annotations: WRITES,
114
+ run: (args, principal) => writing(() => sessionStartTool(ctx.write, principal.email, args)),
115
+ },
116
+ session_list: {
117
+ title: 'List your sessions',
118
+ description: prose('session_list'),
119
+ inputSchema: SESSION_LIST_INPUT_SCHEMA,
120
+ scope: 'edit',
121
+ annotations: READ_ONLY,
122
+ run: (_args, principal) => refusing(() => sessionListTool(ctx.write, principal.email)),
123
+ },
124
+ session_status: {
125
+ title: 'Re-scan a session',
126
+ description: prose('session_status'),
127
+ inputSchema: SESSION_STATUS_INPUT_SCHEMA,
128
+ scope: 'edit',
129
+ annotations: READ_ONLY,
130
+ run: (args, principal) => refusing(() => sessionStatusTool(ctx.write, principal.email, args)),
131
+ },
132
+ Edit: {
133
+ title: 'Edit a file in a session',
134
+ description: prose('Edit'),
107
135
  inputSchema: EDIT_INPUT_SCHEMA,
108
136
  scope: 'edit',
109
- readOnly: false,
137
+ annotations: WRITES,
110
138
  run: (args, principal) => {
111
139
  const parsed = parseEditArgs(args);
112
- return writing(ctx, () => editTool({ view: ctx.view, syncDeps: ctx.syncDeps, write: ctx.write }, principal.email, parsed));
140
+ return writing(() => editTool(ctx.write, principal.email, parsed));
113
141
  },
114
142
  },
115
- {
116
- name: 'Write',
117
- title: 'Create a note',
118
- description: packagedTemplate('mcp', 'Write'),
143
+ Write: {
144
+ title: 'Create a file in a session',
145
+ description: prose('Write'),
119
146
  inputSchema: WRITE_INPUT_SCHEMA,
120
147
  scope: 'edit',
121
- readOnly: false,
148
+ annotations: WRITES,
122
149
  run: (args, principal) => {
123
150
  const parsed = parseWriteArgs(args);
124
- return writing(ctx, () => writeTool({ view: ctx.view, syncDeps: ctx.syncDeps, write: ctx.write }, principal.email, parsed));
151
+ return writing(() => writeTool(ctx.write, principal.email, parsed));
125
152
  },
126
153
  },
127
- ];
154
+ Move: {
155
+ title: 'Move a file in a session',
156
+ description: prose('Move'),
157
+ inputSchema: MOVE_INPUT_SCHEMA,
158
+ scope: 'edit',
159
+ annotations: WRITES,
160
+ run: (args, principal) => {
161
+ const parsed = parseMoveArgs(args);
162
+ return writing(() => moveTool(ctx.write, principal.email, parsed));
163
+ },
164
+ },
165
+ Delete: {
166
+ title: 'Delete a file in a session',
167
+ description: prose('Delete'),
168
+ inputSchema: DELETE_INPUT_SCHEMA,
169
+ scope: 'edit',
170
+ annotations: DESTRUCTIVE,
171
+ run: (args, principal) => {
172
+ const parsed = parseDeleteArgs(args);
173
+ return writing(() => deleteTool(ctx.write, principal.email, parsed));
174
+ },
175
+ },
176
+ session_submit: {
177
+ title: 'Submit a session for approval',
178
+ description: prose('session_submit'),
179
+ inputSchema: SESSION_SUBMIT_INPUT_SCHEMA,
180
+ scope: 'edit',
181
+ annotations: WRITES,
182
+ run: (args, principal) => writing(() => sessionSubmitTool(ctx.write, principal.email, args)),
183
+ },
184
+ session_rebase: {
185
+ title: 'Rebase a session',
186
+ description: prose('session_rebase'),
187
+ inputSchema: SESSION_REBASE_INPUT_SCHEMA,
188
+ scope: 'edit',
189
+ annotations: WRITES,
190
+ run: (args, principal) => writing(() => sessionRebaseTool(ctx.write, principal.email, args)),
191
+ },
192
+ session_discard: {
193
+ title: 'Discard a session',
194
+ description: prose('session_discard'),
195
+ inputSchema: SESSION_DISCARD_INPUT_SCHEMA,
196
+ scope: 'edit',
197
+ annotations: DESTRUCTIVE,
198
+ run: (args, principal) => writing(() => sessionDiscardTool(ctx.write, principal.email, args)),
199
+ },
200
+ ctxr: {
201
+ title: 'Run a read-only ctxr command',
202
+ description: prose('ctxr'),
203
+ inputSchema: CTXR_INPUT_SCHEMA,
204
+ scope: 'read',
205
+ annotations: READ_ONLY,
206
+ render: renderCli,
207
+ run: (args, principal) => {
208
+ const parsed = parseCliArgs(args, false);
209
+ return refusing(() => ctxrTool(cli, principal.email, parsed));
210
+ },
211
+ },
212
+ ctxr_write: {
213
+ title: 'Run a writing ctxr command in a session',
214
+ description: prose('ctxr_write'),
215
+ inputSchema: CTXR_WRITE_INPUT_SCHEMA,
216
+ scope: 'edit',
217
+ annotations: WRITES,
218
+ render: renderCli,
219
+ run: (args, principal) => {
220
+ const parsed = parseCliArgs(args, true);
221
+ return writing(() => ctxrWriteTool(cli, principal.email, parsed));
222
+ },
223
+ },
224
+ };
225
+ const unregistered = Object.keys(implementations).filter((name) => !TOOL_REGISTRY.some((t) => t.name === name));
226
+ const unimplemented = TOOL_REGISTRY.filter((t) => implementations[t.name] === undefined).map((t) => t.name);
227
+ if (unregistered.length > 0 || unimplemented.length > 0) {
228
+ throw new Error(`the MCP tool registry and its implementations differ: unregistered ${unregistered.join(', ') || 'none'}; unimplemented ${unimplemented.join(', ') || 'none'}`);
229
+ }
230
+ return TOOL_REGISTRY.map((entry) => ({ name: entry.name, ...implementations[entry.name] }));
128
231
  }
129
232
  //# sourceMappingURL=index.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"index.js","sourceRoot":"","sources":["../../../../src/core/mcp/tools/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,gBAAgB,EAAE,MAAM,oBAAoB,CAAC;AAKtD,OAAO,EAAE,aAAa,EAAE,OAAO,EAAE,oBAAoB,EAAE,gBAAgB,EAAE,MAAM,cAAc,CAAC;AAC9F,OAAO,EAAE,iBAAiB,EAAE,QAAQ,EAAE,aAAa,EAAE,cAAc,EAAE,kBAAkB,EAAE,SAAS,EAAE,MAAM,WAAW,CAAC;AACtH,OAAO,EACL,iBAAiB,EACjB,QAAQ,EACR,iBAAiB,EACjB,QAAQ,EACR,aAAa,EACb,aAAa,EACb,aAAa,EACb,iBAAiB,EACjB,QAAQ,EACR,UAAU,EACV,UAAU,EACV,UAAU,GACX,MAAM,YAAY,CAAC;AACpB,OAAO,EAAE,IAAI,EAAE,iBAAiB,EAAE,aAAa,EAAE,MAAM,WAAW,CAAC;AACnE,OAAO,EAAE,mBAAmB,EAAE,gBAAgB,EAAE,eAAe,EAAE,MAAM,aAAa,CAAC;AAErF;;;;;GAKG;AAEH,MAAM,UAAU,kBAAkB,CAAC,SAAiB;IAClD,OAAO,gBAAgB,CAAC,KAAK,EAAE,qBAAqB,CAAC,CAAC,UAAU,CAAC,gBAAgB,EAAE,SAAS,CAAC,CA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AAC,IAAI,EAAE,GAAG,eAAe,CAAC,KAAK,CAAC,IAAI,CAAE,EAAE,CAAC,CAAC,CAAC;AAC/F,CAAC"}
@@ -0,0 +1,145 @@
1
+ import { type WriteDeps } from '../sessions.js';
2
+ /**
3
+ * serve-the-session-lifecycle-to-chat-apps D3 (remote-access spec, *A member
4
+ * works in named sessions of their own*, *`session_submit` validates, commits
5
+ * as the member and opens the pull request*, *A member's session can be
6
+ * rebased or discarded*): one tool per `ctxr session <verb>`, each calling the
7
+ * same core the command calls, with the command's options as fields. The MCP
8
+ * layer adds the ownership check, the member as commit author, and the
9
+ * confinement to sessions started over MCP. Server paths never leave: a
10
+ * session is named by its directory and addressed by its store-relative root.
11
+ */
12
+ /** D3: `session_status`'s unified diff is bounded to this many bytes. */
13
+ export declare const STATUS_DIFF_MAX_BYTES: number;
14
+ export declare const SESSION_START_INPUT_SCHEMA: {
15
+ readonly type: 'object';
16
+ readonly properties: {
17
+ readonly label: {
18
+ readonly type: 'string';
19
+ readonly description: 'A short name for what the session is for, e.g. "kestrel-launch"; it becomes part of the branch and directory name. Optional.';
20
+ };
21
+ };
22
+ };
23
+ export interface SessionStartResult {
24
+ session: string;
25
+ root: string;
26
+ branch: string;
27
+ label: string | null;
28
+ message: string;
29
+ }
30
+ /** Under the write mutex. */
31
+ export declare function sessionStartTool(write: WriteDeps, email: string, args: Record<string, unknown>): Promise<SessionStartResult>;
32
+ export declare const SESSION_LIST_INPUT_SCHEMA: {
33
+ readonly type: 'object';
34
+ readonly properties: {};
35
+ };
36
+ export interface SessionRow {
37
+ session: string;
38
+ root: string;
39
+ branch: string;
40
+ label: string | null;
41
+ /** `capture` for a session the capture tool opened, which the session cap does not count. */
42
+ kind: 'session' | 'capture';
43
+ started_at: string | null;
44
+ uncommitted: boolean;
45
+ ahead: number;
46
+ pull_request: {
47
+ number: number | null;
48
+ state: 'open' | 'unknown';
49
+ url: string | null;
50
+ } | null;
51
+ /** With change approval declared: the decision `ctxr review list` reports for the open pull request. */
52
+ review: {
53
+ state: string;
54
+ comment: string | null;
55
+ } | null;
56
+ }
57
+ export declare function sessionListTool(write: WriteDeps, email: string): Promise<{
58
+ sessions: SessionRow[];
59
+ forge_reachable: boolean;
60
+ limit: number;
61
+ }>;
62
+ export declare const SESSION_STATUS_INPUT_SCHEMA: {
63
+ readonly type: 'object';
64
+ readonly properties: {
65
+ readonly session: {
66
+ readonly type: 'string';
67
+ readonly description: 'The session\'s directory name, as session_start or session_list gave it.';
68
+ };
69
+ readonly diff: {
70
+ readonly type: 'boolean';
71
+ readonly description: "Also return the unified diff of uncommitted work, up to 100 KB.";
72
+ };
73
+ };
74
+ readonly required: readonly ['session'];
75
+ };
76
+ export declare function sessionStatusTool(write: WriteDeps, email: string, args: Record<string, unknown>): Promise<Record<string, unknown>>;
77
+ export declare const SESSION_SUBMIT_INPUT_SCHEMA: {
78
+ readonly type: 'object';
79
+ readonly properties: {
80
+ readonly session: {
81
+ readonly type: 'string';
82
+ readonly description: 'The session\'s directory name, as session_start or session_list gave it.';
83
+ };
84
+ readonly branch: {
85
+ readonly type: 'string';
86
+ readonly description: 'The branch name the pull request carries, e.g. "notes/kestrel-intro"; the session\'s branch is renamed to it.';
87
+ };
88
+ readonly message: {
89
+ readonly type: 'string';
90
+ readonly description: 'The commit message: a subject line, a blank line, then what changed and why.';
91
+ };
92
+ readonly title: {
93
+ readonly type: 'string';
94
+ readonly description: 'The pull request title.';
95
+ };
96
+ readonly body: {
97
+ readonly type: 'string';
98
+ readonly description: 'The pull request body: why, what changed, route, verification and follow-ups. The Pages and Knowledge changes sections are appended for you; leave them out.';
99
+ };
100
+ };
101
+ readonly required: readonly ['session', 'branch', 'message', 'title', 'body'];
102
+ };
103
+ /** Under the write mutex. */
104
+ export declare function sessionSubmitTool(write: WriteDeps, email: string, args: Record<string, unknown>): Promise<Record<string, unknown>>;
105
+ export declare const SESSION_REBASE_INPUT_SCHEMA: {
106
+ readonly type: 'object';
107
+ readonly properties: {
108
+ readonly session: {
109
+ readonly type: 'string';
110
+ readonly description: 'The session\'s directory name, as session_start or session_list gave it.';
111
+ };
112
+ readonly continue: {
113
+ readonly type: 'boolean';
114
+ readonly description: 'Stage the resolved files and continue the rebase in progress.';
115
+ };
116
+ readonly abort: {
117
+ readonly type: 'boolean';
118
+ readonly description: 'Abort the rebase in progress and restore the session as it was.';
119
+ };
120
+ };
121
+ readonly required: readonly ['session'];
122
+ };
123
+ /** Under the write mutex. A conflict is a result, not a refusal: the conflicting files are returned with both sides. */
124
+ export declare function sessionRebaseTool(write: WriteDeps, email: string, args: Record<string, unknown>): Promise<Record<string, unknown>>;
125
+ export declare const SESSION_DISCARD_INPUT_SCHEMA: {
126
+ readonly type: 'object';
127
+ readonly properties: {
128
+ readonly session: {
129
+ readonly type: 'string';
130
+ readonly description: 'The session\'s directory name, as session_start or session_list gave it.';
131
+ };
132
+ readonly force: {
133
+ readonly type: 'boolean';
134
+ readonly description: 'Discard uncommitted changes and commits the remote branch lacks. Without it, a session holding unpublished work is refused.';
135
+ };
136
+ readonly close_pull_request: {
137
+ readonly type: 'boolean';
138
+ readonly description: "Also close the session's open pull request.";
139
+ };
140
+ };
141
+ readonly required: readonly ['session'];
142
+ };
143
+ /** Under the write mutex. Destructive. */
144
+ export declare function sessionDiscardTool(write: WriteDeps, email: string, args: Record<string, unknown>): Promise<Record<string, unknown>>;
145
+ //# sourceMappingURL=sessions.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"sessions.d.ts","sourceRoot":"","sources":["../../../../src/core/mcp/tools/sessions.ts"],"names":[],"mappings":"AAWA,OAAO,EAA2C,KAAK,SAAS,EAAE,MAAM,gBAAgB,CAAC;AAEzF;;;;;;;;;GASG;AAEH,yEAAyE;AACzE,eAAO,MAAM,qBAAqB,QAAa,CAAC;AA4BhD,eAAO,MAAM,0BAA0B;aACrC,IAAI,EAAE,QAAQ;aACd,UAAU;iBACR,KAAK;qBAAI,IAAI,EAAE,QAAQ;qBAAE,WAAW,EAAE,8HAA8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