@cotal-ai/linear 0.0.0-bootstrap.0 → 0.76.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.
@@ -0,0 +1,71 @@
1
+ /**
2
+ * The Cotal endpoint contract for one Linear MCP account: a FIXED command catalog whose envelopes
3
+ * carry the upstream MCP values as data. Linear's tools are not republished as Cotal commands, so
4
+ * a Linear inventory change never changes this cluster; the caller reads `inventory` and pins its
5
+ * digest on every request, and a request against a changed inventory is refused before dispatch.
6
+ *
7
+ * Every command needs the one `linear.mcp` capability. That is a call permission on the endpoint,
8
+ * not per-tool authorization: what a call can reach upstream is decided by the account's Linear
9
+ * token and mode (`readonly` serves `/mcp/readonly`).
10
+ *
11
+ * `inventory` is paged so every reply fits a broker message. Each page is bounded in bytes, carries
12
+ * every entry verbatim (an entry is never cut or dropped; one that cannot fit a reply refuses the
13
+ * page), and returns an opaque cursor bound to the inventory digest. A cursor or pin from another
14
+ * inventory is refused before anything is sent upstream.
15
+ */
16
+ import { type EpCommandDef } from "@cotal-ai/core";
17
+ import type { LinearInventory, LinearUpstream, UpstreamReply } from "./upstream.js";
18
+ export declare const LINEAR_CLUSTER_URN = "ai.cotal.linear";
19
+ export declare const LINEAR_CAPABILITY = "linear.mcp";
20
+ declare const SECTIONS: readonly ["tools", "resources", "resourceTemplates", "prompts"];
21
+ type Section = (typeof SECTIONS)[number];
22
+ /** Item bytes per page, and the most one reply may carry: a single entry over the page budget is
23
+ * sent alone, and one over the reply cap refuses rather than being cut. Both sit under the broker's
24
+ * default 1 MiB message size with room for the envelope. */
25
+ export declare const INVENTORY_PAGE_BYTES: number;
26
+ export declare const INVENTORY_REPLY_MAX_BYTES: number;
27
+ /** One bounded page of `inv`. Pure: the caller has already read the inventory. */
28
+ export declare function inventoryPage(inv: LinearInventory, args: {
29
+ inventoryDigest?: string;
30
+ section?: Section;
31
+ cursor?: string;
32
+ limit?: number;
33
+ }): Record<string, unknown>;
34
+ /** Every command this contract declares, in catalog order. */
35
+ export declare const LINEAR_COMMANDS: readonly string[];
36
+ /** Map a forwarded reply onto the endpoint reply. Only `result` succeeds; everything else is an
37
+ * error carrying the outcome the upstream layer established, never a stronger one. */
38
+ export declare function resultOrThrow(reply: UpstreamReply): {
39
+ result: Record<string, unknown>;
40
+ inventoryDigest: string;
41
+ };
42
+ /** Every contract artifact a registration publishes: each distinct schema root and its manifest. */
43
+ export declare const linearContractArtifactValues: () => unknown[];
44
+ export declare function linearClusterDocument(): {
45
+ urn: string;
46
+ revision: number;
47
+ attributes: unknown[];
48
+ events: unknown[];
49
+ commands: {
50
+ name: string;
51
+ class: "ephemeral";
52
+ targeted: boolean;
53
+ capability: string;
54
+ inputDigest: string;
55
+ outputDigest: string;
56
+ }[];
57
+ };
58
+ export declare function linearClusterArtifacts(): {
59
+ document: ReturnType<typeof linearClusterDocument>;
60
+ rootDigest: string;
61
+ manifest: {
62
+ v: 1;
63
+ root: string;
64
+ members: string[];
65
+ };
66
+ closureDigest: string;
67
+ };
68
+ /** The `EpCommandDef[]` `serveEndpoint` consumes. The call deadline bounds the upstream request. */
69
+ export declare function linearCommandDefs(upstream: LinearUpstream): EpCommandDef[];
70
+ export {};
71
+ //# sourceMappingURL=contract.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"contract.d.ts","sourceRoot":"","sources":["../src/contract.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;GAcG;AACH,OAAO,EAIL,KAAK,YAAY,EAGlB,MAAM,gBAAgB,CAAC;AAExB,OAAO,KAAK,EAAE,eAAe,EAAE,cAAc,EAAE,aAAa,EAAE,MAAM,eAAe,CAAC;AAEpF,eAAO,MAAM,kBAAkB,oBAAoB,CAAC;AACpD,eAAO,MAAM,iBAAiB,eAAe,CAAC;AAM9C,QAAA,MAAM,QAAQ,iEAAkE,CAAC;AACjF,KAAK,OAAO,GAAG,CAAC,OAAO,QAAQ,CAAC,CAAC,MAAM,CAAC,CAAC;AA+CzC;;6DAE6D;AAC7D,eAAO,MAAM,oBAAoB,QAAa,CAAC;AAC/C,eAAO,MAAM,yBAAyB,QAAa,CAAC;AAqBpD,kFAAkF;AAClF,wBAAgB,aAAa,CAAC,GAAG,EAAE,eAAe,EAAE,IAAI,EAAE;IAAE,eAAe,CAAC,EAAE,MAAM,CAAC;IAAC,OAAO,CAAC,EAAE,OAAO,CAAC;IAAC,MAAM,CAAC,EAAE,MAAM,CAAC;IAAC,KAAK,CAAC,EAAE,MAAM,CAAA;CAAE,GAAG,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CA8CnK;AA8FD,8DAA8D;AAC9D,eAAO,MAAM,eAAe,EAAE,SAAS,MAAM,EAA4B,CAAC;AAE1E;uFACuF;AACvF,wBAAgB,aAAa,CAAC,KAAK,EAAE,aAAa,GAAG;IAAE,MAAM,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAAC;IAAC,eAAe,EAAE,MAAM,CAAA;CAAE,CAuBhH;AAQD,oGAAoG;AACpG,eAAO,MAAM,4BAA4B,iBAAuB,CAAC;AAEjE,wBAAgB,qBAAqB;;;gBAIf,OAAO,EAAE;YACb,OAAO,EAAE;;;;;;;;;EAU1B;AAED,wBAAgB,sBAAsB,IAAI;IACxC,QAAQ,EAAE,UAAU,CAAC,OAAO,qBAAqB,CAAC,CAAC;IACnD,UAAU,EAAE,MAAM,CAAC;IACnB,QAAQ,EAAE;QAAE,CAAC,EAAE,CAAC,CAAC;QAAC,IAAI,EAAE,MAAM,CAAC;QAAC,OAAO,EAAE,MAAM,EAAE,CAAA;KAAE,CAAC;IACpD,aAAa,EAAE,MAAM,CAAC;CACvB,CAKA;AAED,oGAAoG;AACpG,wBAAgB,iBAAiB,CAAC,QAAQ,EAAE,cAAc,GAAG,YAAY,EAAE,CAa1E"}
@@ -0,0 +1,287 @@
1
+ /**
2
+ * The Cotal endpoint contract for one Linear MCP account: a FIXED command catalog whose envelopes
3
+ * carry the upstream MCP values as data. Linear's tools are not republished as Cotal commands, so
4
+ * a Linear inventory change never changes this cluster; the caller reads `inventory` and pins its
5
+ * digest on every request, and a request against a changed inventory is refused before dispatch.
6
+ *
7
+ * Every command needs the one `linear.mcp` capability. That is a call permission on the endpoint,
8
+ * not per-tool authorization: what a call can reach upstream is decided by the account's Linear
9
+ * token and mode (`readonly` serves `/mcp/readonly`).
10
+ *
11
+ * `inventory` is paged so every reply fits a broker message. Each page is bounded in bytes, carries
12
+ * every entry verbatim (an entry is never cut or dropped; one that cannot fit a reply refuses the
13
+ * page), and returns an opaque cursor bound to the inventory digest. A cursor or pin from another
14
+ * inventory is refused before anything is sent upstream.
15
+ */
16
+ import { contractDigest, EpEnvelopeError, serviceContractTable, } from "@cotal-ai/core";
17
+ import { renderedBytes } from "./upstream.js";
18
+ export const LINEAR_CLUSTER_URN = "ai.cotal.linear";
19
+ export const LINEAR_CAPABILITY = "linear.mcp";
20
+ const OBJECT = { type: "object" };
21
+ const DIGEST = { type: "string", minLength: 1, maxLength: 128 };
22
+ const TIMEOUT = { type: "integer", minimum: 1, maximum: 120000 };
23
+ const SECTIONS = ["tools", "resources", "resourceTemplates", "prompts"];
24
+ const INVENTORY_INPUT = {
25
+ type: "object",
26
+ additionalProperties: false,
27
+ properties: {
28
+ refresh: { type: "boolean" },
29
+ inventoryDigest: DIGEST,
30
+ section: { enum: [...SECTIONS] },
31
+ cursor: { type: "string", minLength: 1, maxLength: 512 },
32
+ limit: { type: "integer", minimum: 1, maximum: 500 },
33
+ },
34
+ };
35
+ /** One page of the inventory. `summary` (server, capabilities, instructions, the capability paths
36
+ * this endpoint does not represent, and per-section counts) rides the first page only. Entries are
37
+ * the server's objects, verbatim. */
38
+ const INVENTORY_OUTPUT = {
39
+ type: "object",
40
+ additionalProperties: false,
41
+ required: ["digest", "fetchedAt", "section", "start", "total", "items"],
42
+ properties: {
43
+ digest: DIGEST,
44
+ fetchedAt: { type: "string" },
45
+ summary: {
46
+ type: "object",
47
+ required: ["endpoint", "mode", "server", "capabilities", "unsupported", "counts", "pages", "bytes"],
48
+ properties: {
49
+ endpoint: { type: "string" },
50
+ mode: { enum: ["write", "readonly"] },
51
+ server: OBJECT,
52
+ instructions: { type: "string" },
53
+ capabilities: OBJECT,
54
+ unsupported: { type: "array", items: { type: "string" } },
55
+ counts: OBJECT,
56
+ pages: { type: "integer", minimum: 0 },
57
+ bytes: { type: "integer", minimum: 0 },
58
+ },
59
+ },
60
+ section: { enum: [...SECTIONS] },
61
+ start: { type: "integer", minimum: 0 },
62
+ total: { type: "integer", minimum: 0 },
63
+ items: { type: "array", items: OBJECT },
64
+ nextCursor: { type: "string" },
65
+ },
66
+ };
67
+ /** Item bytes per page, and the most one reply may carry: a single entry over the page budget is
68
+ * sent alone, and one over the reply cap refuses rather than being cut. Both sit under the broker's
69
+ * default 1 MiB message size with room for the envelope. */
70
+ export const INVENTORY_PAGE_BYTES = 256 * 1024;
71
+ export const INVENTORY_REPLY_MAX_BYTES = 768 * 1024;
72
+ function encodeCursor(c) {
73
+ return Buffer.from(JSON.stringify(c)).toString("base64url");
74
+ }
75
+ function decodeCursor(raw) {
76
+ try {
77
+ const c = JSON.parse(Buffer.from(raw, "base64url").toString("utf8"));
78
+ if (typeof c.d === "string" && SECTIONS.includes(c.s) && Number.isSafeInteger(c.i) && c.i >= 0)
79
+ return c;
80
+ }
81
+ catch {
82
+ // fall through
83
+ }
84
+ throw new EpEnvelopeError("bad-request", "the inventory cursor is not one this endpoint issued", undefined, "not-executed");
85
+ }
86
+ // Pages are composed in the size the agent tool prints, which is never smaller than the wire form.
87
+ const sizeOf = renderedBytes;
88
+ /** One bounded page of `inv`. Pure: the caller has already read the inventory. */
89
+ export function inventoryPage(inv, args) {
90
+ const cursor = args.cursor !== undefined ? decodeCursor(args.cursor) : undefined;
91
+ if (cursor && args.inventoryDigest !== undefined && cursor.d !== args.inventoryDigest)
92
+ throw new EpEnvelopeError("bad-request", "the cursor and inventoryDigest name different inventories", undefined, "not-executed");
93
+ if (cursor && args.section !== undefined && cursor.s !== args.section)
94
+ throw new EpEnvelopeError("bad-request", "the cursor and section disagree", undefined, "not-executed");
95
+ const pin = cursor?.d ?? args.inventoryDigest;
96
+ if (pin !== undefined && pin !== inv.digest)
97
+ throw new EpEnvelopeError("failed-precondition", `the inventory changed (now ${inv.digest}); read it again from the first page`, [{ kind: ERROR_DETAIL, reason: "stale-inventory" }], "not-executed");
98
+ const section = cursor?.s ?? args.section ?? "tools";
99
+ const list = (inv[section] ?? []);
100
+ const start = cursor?.i ?? 0;
101
+ if (start > list.length)
102
+ throw new EpEnvelopeError("bad-request", "the inventory cursor is past the end of its section", undefined, "not-executed");
103
+ const limit = args.limit ?? 500;
104
+ const summary = cursor === undefined ? {
105
+ endpoint: inv.endpoint, mode: inv.mode, server: inv.server,
106
+ ...(inv.instructions !== undefined ? { instructions: inv.instructions } : {}),
107
+ capabilities: inv.capabilities, unsupported: inv.unsupported,
108
+ counts: Object.fromEntries(SECTIONS.filter((k) => inv[k] !== undefined).map((k) => [k, inv[k].length])),
109
+ pages: inv.pages, bytes: inv.bytes,
110
+ } : undefined;
111
+ let used = summary ? sizeOf(summary) : 0;
112
+ if (used > INVENTORY_PAGE_BYTES)
113
+ throw new EpEnvelopeError("resource-exhausted", `the inventory summary is ${used} bytes, over the ${INVENTORY_PAGE_BYTES}-byte page budget; it is not cut`, undefined, "not-executed");
114
+ const items = [];
115
+ let i = start;
116
+ while (i < list.length && items.length < limit) {
117
+ const n = sizeOf(list[i]);
118
+ if (items.length > 0 && used + n > INVENTORY_PAGE_BYTES)
119
+ break;
120
+ if (used + n > INVENTORY_REPLY_MAX_BYTES)
121
+ throw new EpEnvelopeError("resource-exhausted", `${section}[${i}] is ${n} bytes and cannot fit one reply; it is not cut`, undefined, "not-executed");
122
+ items.push(list[i]);
123
+ used += n;
124
+ i++;
125
+ }
126
+ let next;
127
+ if (i < list.length)
128
+ next = { d: inv.digest, s: section, i };
129
+ else {
130
+ const following = SECTIONS.slice(SECTIONS.indexOf(section) + 1).find((k) => (inv[k]?.length ?? 0) > 0);
131
+ if (following)
132
+ next = { d: inv.digest, s: following, i: 0 };
133
+ }
134
+ return {
135
+ digest: inv.digest, fetchedAt: inv.fetchedAt, ...(summary ? { summary } : {}),
136
+ section, start, total: list.length, items, ...(next ? { nextCursor: encodeCursor(next) } : {}),
137
+ };
138
+ }
139
+ const CALL_TOOL_INPUT = {
140
+ type: "object",
141
+ additionalProperties: false,
142
+ required: ["name", "inventoryDigest"],
143
+ properties: { name: { type: "string", minLength: 1 }, arguments: OBJECT, inventoryDigest: DIGEST, timeoutMs: TIMEOUT },
144
+ };
145
+ const READ_RESOURCE_INPUT = {
146
+ type: "object",
147
+ additionalProperties: false,
148
+ required: ["uri", "inventoryDigest"],
149
+ properties: { uri: { type: "string", minLength: 1 }, inventoryDigest: DIGEST, timeoutMs: TIMEOUT },
150
+ };
151
+ const GET_PROMPT_INPUT = {
152
+ type: "object",
153
+ additionalProperties: false,
154
+ required: ["name", "inventoryDigest"],
155
+ properties: {
156
+ name: { type: "string", minLength: 1 },
157
+ arguments: { type: "object", additionalProperties: { type: "string" } },
158
+ inventoryDigest: DIGEST,
159
+ timeoutMs: TIMEOUT,
160
+ },
161
+ };
162
+ const COMPLETE_INPUT = {
163
+ type: "object",
164
+ additionalProperties: false,
165
+ required: ["params", "inventoryDigest"],
166
+ properties: { params: OBJECT, inventoryDigest: DIGEST, timeoutMs: TIMEOUT },
167
+ };
168
+ /** The upstream MCP result object, verbatim (a tool result keeps `content`, `structuredContent`
169
+ * and `isError`), plus the inventory digest it ran against. */
170
+ const RESULT_OUTPUT = {
171
+ type: "object",
172
+ additionalProperties: false,
173
+ required: ["result", "inventoryDigest"],
174
+ properties: { result: OBJECT, inventoryDigest: DIGEST },
175
+ };
176
+ const pinned = (args) => args.inventoryDigest;
177
+ const ROWS = [
178
+ {
179
+ name: "inventory", input: INVENTORY_INPUT, output: INVENTORY_OUTPUT,
180
+ handler: async (u, a, timeoutMs) => {
181
+ // A cursor is checked before any upstream read, so a malformed one never costs a request.
182
+ if (typeof a.cursor === "string")
183
+ decodeCursor(a.cursor);
184
+ let inv;
185
+ try {
186
+ inv = await u.inventory({ refresh: a.refresh === true, signal: AbortSignal.timeout(timeoutMs ?? u.limits.defaultTimeoutMs) });
187
+ }
188
+ catch (e) {
189
+ throw new EpEnvelopeError("unavailable", e instanceof Error ? e.message : "Linear discovery failed", [{ kind: ERROR_DETAIL, reason: "discovery-failed" }]);
190
+ }
191
+ return inventoryPage(inv, a);
192
+ },
193
+ },
194
+ {
195
+ name: "call-tool", input: CALL_TOOL_INPUT, output: RESULT_OUTPUT,
196
+ handler: async (u, a, timeoutMs) => resultOrThrow(await u.callTool({
197
+ name: a.name, arguments: a.arguments, inventoryDigest: pinned(a), timeoutMs,
198
+ })),
199
+ },
200
+ {
201
+ name: "read-resource", input: READ_RESOURCE_INPUT, output: RESULT_OUTPUT,
202
+ handler: async (u, a, timeoutMs) => resultOrThrow(await u.readResource({ uri: a.uri, inventoryDigest: pinned(a), timeoutMs })),
203
+ },
204
+ {
205
+ name: "get-prompt", input: GET_PROMPT_INPUT, output: RESULT_OUTPUT,
206
+ handler: async (u, a, timeoutMs) => resultOrThrow(await u.getPrompt({
207
+ name: a.name, arguments: a.arguments, inventoryDigest: pinned(a), timeoutMs,
208
+ })),
209
+ },
210
+ {
211
+ name: "complete", input: COMPLETE_INPUT, output: RESULT_OUTPUT,
212
+ handler: async (u, a, timeoutMs) => resultOrThrow(await u.complete({ params: a.params, inventoryDigest: pinned(a), timeoutMs })),
213
+ },
214
+ ];
215
+ const ERROR_DETAIL = "ai.cotal.linear.upstream";
216
+ /** Every command this contract declares, in catalog order. */
217
+ export const LINEAR_COMMANDS = ROWS.map((r) => r.name);
218
+ /** Map a forwarded reply onto the endpoint reply. Only `result` succeeds; everything else is an
219
+ * error carrying the outcome the upstream layer established, never a stronger one. */
220
+ export function resultOrThrow(reply) {
221
+ if (reply.kind === "result")
222
+ return { result: reply.result, inventoryDigest: reply.inventoryDigest };
223
+ if (reply.kind === "refused") {
224
+ const code = reply.reason === "queue-full" ? "resource-exhausted"
225
+ : reply.reason === "unknown-tool" ? "not-found"
226
+ : reply.reason === "not-advertised" ? "unimplemented"
227
+ : reply.reason === "stale-inventory" ? "failed-precondition"
228
+ : reply.reason === "deadline" ? "deadline-exceeded"
229
+ : "unavailable";
230
+ throw new EpEnvelopeError(code, reply.detail, [{ kind: ERROR_DETAIL, reason: reply.reason }], "not-executed");
231
+ }
232
+ if (reply.kind === "protocol-error") {
233
+ const code = reply.code === -32602 ? "bad-request" : reply.code === -32601 ? "unimplemented" : "internal";
234
+ throw new EpEnvelopeError(code, `Linear MCP error ${reply.code}: ${reply.message}`, [{ kind: ERROR_DETAIL, reason: "protocol-error", mcpCode: reply.code, ...(reply.data !== undefined ? { data: reply.data } : {}) }], reply.outcome);
235
+ }
236
+ const code = reply.reason === "timeout" ? "deadline-exceeded"
237
+ : reply.reason === "cancelled" ? "cancelled"
238
+ : reply.reason === "output-too-large" || reply.reason === "rate-limited" ? "resource-exhausted"
239
+ : reply.reason === "unauthenticated" || reply.reason === "permission-denied" ? "failed-precondition"
240
+ : "unavailable";
241
+ // A post-dispatch failure keeps its outcome; the code only says which kind of failure it was.
242
+ throw new EpEnvelopeError(code, reply.detail, [{ kind: ERROR_DETAIL, reason: reply.reason }], reply.outcome);
243
+ }
244
+ const TABLE = serviceContractTable(ROWS);
245
+ function closureDigestOfSource(root) {
246
+ return contractDigest({ v: 1, root: contractDigest(root), members: [] });
247
+ }
248
+ /** Every contract artifact a registration publishes: each distinct schema root and its manifest. */
249
+ export const linearContractArtifactValues = TABLE.artifactValues;
250
+ export function linearClusterDocument() {
251
+ return {
252
+ urn: LINEAR_CLUSTER_URN,
253
+ revision: 1,
254
+ attributes: [],
255
+ events: [],
256
+ commands: ROWS.map((r) => ({
257
+ name: r.name,
258
+ class: "ephemeral",
259
+ targeted: false,
260
+ capability: LINEAR_CAPABILITY,
261
+ inputDigest: closureDigestOfSource(r.input),
262
+ outputDigest: closureDigestOfSource(r.output),
263
+ })),
264
+ };
265
+ }
266
+ export function linearClusterArtifacts() {
267
+ const document = linearClusterDocument();
268
+ const rootDigest = contractDigest(document);
269
+ const manifest = { v: 1, root: rootDigest, members: [] };
270
+ return { document, rootDigest, manifest, closureDigest: contractDigest(manifest) };
271
+ }
272
+ /** The `EpCommandDef[]` `serveEndpoint` consumes. The call deadline bounds the upstream request. */
273
+ export function linearCommandDefs(upstream) {
274
+ return ROWS.map((r) => ({
275
+ command: r.name,
276
+ contract: TABLE.contracts[r.name],
277
+ handler: (ctx) => {
278
+ const args = (ctx.request.args ?? {});
279
+ const requested = typeof args.timeoutMs === "number" ? args.timeoutMs : undefined;
280
+ // Leave the reply a second of the caller's budget to travel back.
281
+ const deadline = ctx.request.deadlineMs !== undefined ? Math.max(1, ctx.request.deadlineMs - 1000) : undefined;
282
+ const timeoutMs = requested !== undefined && deadline !== undefined ? Math.min(requested, deadline) : requested ?? deadline;
283
+ return r.handler(upstream, args, timeoutMs);
284
+ },
285
+ }));
286
+ }
287
+ //# sourceMappingURL=contract.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"contract.js","sourceRoot":"","sources":["../src/contract.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;GAcG;AACH,OAAO,EACL,cAAc,EACd,eAAe,EACf,oBAAoB,GAIrB,MAAM,gBAAgB,CAAC;AACxB,OAAO,EAAE,aAAa,EAAE,MAAM,eAAe,CAAC;AAG9C,MAAM,CAAC,MAAM,kBAAkB,GAAG,iBAAiB,CAAC;AACpD,MAAM,CAAC,MAAM,iBAAiB,GAAG,YAAY,CAAC;AAE9C,MAAM,MAAM,GAAG,EAAE,IAAI,EAAE,QAAQ,EAAW,CAAC;AAC3C,MAAM,MAAM,GAAG,EAAE,IAAI,EAAE,QAAQ,EAAE,SAAS,EAAE,CAAC,EAAE,SAAS,EAAE,GAAG,EAAW,CAAC;AACzE,MAAM,OAAO,GAAG,EAAE,IAAI,EAAE,SA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AC,CAAC,CAAC,SAAS,IAAI,QAAQ,CAAC;YAC5H,OAAO,CAAC,CAAC,OAAO,CAAC,QAAQ,EAAE,IAAI,EAAE,SAAS,CAAC,CAAC;QAC9C,CAAC;KACF,CAAC,CAAC,CAAC;AACN,CAAC"}
@@ -0,0 +1,6 @@
1
+ export { LinearUpstream, DEFAULT_LIMITS, type LinearInventory, type LinearLimits, type UpstreamReply } from "./upstream.js";
2
+ export { LINEAR_MCP_ORIGIN, LINEAR_MCP_PATHS, linearMcpUrl, type LinearMode } from "./origin.js";
3
+ export { loadAccount, type LinearAccount } from "./account.js";
4
+ export { inventoryPage, linearClusterArtifacts, linearCommandDefs, linearContractArtifactValues, INVENTORY_PAGE_BYTES, INVENTORY_REPLY_MAX_BYTES, LINEAR_CAPABILITY, LINEAR_CLUSTER_URN, LINEAR_COMMANDS } from "./contract.js";
5
+ export { assertLinearEndpointName, linearCallerCapabilities, provisionLinearCaller, registerLinearEndpoint, renewalDelayMs, runLinearEndpoint, type LinearEndpointHandle, type LinearRegistration, type LinearServeBundle, } from "./serve.js";
6
+ //# sourceMappingURL=index.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAqCA,OAAO,EAAE,cAAc,EAAE,cAAc,EAAE,KAAK,eAAe,EAAE,KAAK,YAAY,EAAE,KAAK,aAAa,EAAE,MAAM,eAAe,CAAC;AAC5H,OAAO,EAAE,iBAAiB,EAAE,gBAAgB,EAAE,YAAY,EAAE,KAAK,UAAU,EAAE,MAAM,aAAa,CAAC;AACjG,OAAO,EAAE,WAAW,EAAE,KAAK,aAAa,EAAE,MAAM,cAAc,CAAC;AAC/D,OAAO,EAAE,aAAa,EAAE,sBAAsB,EAAE,iBAAiB,EAAE,4BAA4B,EAAE,oBAAoB,EAAE,yBAAyB,EAAE,iBAAiB,EAAE,kBAAkB,EAAE,eAAe,EAAE,MAAM,eAAe,CAAC;AAChO,OAAO,EACL,wBAAwB,EACxB,wBAAwB,EACxB,qBAAqB,EACrB,sBAAsB,EACtB,cAAc,EACd,iBAAiB,EACjB,KAAK,oBAAoB,EACzB,KAAK,kBAAkB,EACvB,KAAK,iBAAiB,GACvB,MAAM,YAAY,CAAC"}
package/dist/index.js ADDED
@@ -0,0 +1,41 @@
1
+ import { registry } from "@cotal-ai/core";
2
+ import { serverFlag, spaceFlag } from "@cotal-ai/workspace";
3
+ import { linear, USAGE } from "./cli.js";
4
+ /**
5
+ * `@cotal-ai/linear`: the official Linear MCP server as a registered Cotal endpoint, plus the
6
+ * operator commands that set it up, as an operator-installed CLI extension. `cotal ext add
7
+ * @cotal-ai/linear` makes `cotal linear` appear in help, completion and dispatch. Self-registers
8
+ * into the shared core Registry on import.
9
+ */
10
+ const linearCommand = {
11
+ kind: "command",
12
+ name: "linear",
13
+ group: "Integrations",
14
+ summary: "Linear MCP: accounts, inventory, tool calls, and a registered Linear endpoint for agents",
15
+ usage: USAGE,
16
+ positionals: "<subcommand> …",
17
+ prepareMeshTarget: false,
18
+ flags: [
19
+ { name: "mode", type: "string", value: "<write|readonly>", description: "account add: which Linear MCP server the account uses" },
20
+ { name: "token-stdin", type: "boolean", description: "account add: read the API key or OAuth token from stdin and store it 0600" },
21
+ { name: "token-file", type: "string", value: "<path>", description: "account add: use an existing 0600 file holding the token" },
22
+ { name: "json", type: "boolean", description: "inventory: print the full inventory" },
23
+ { name: "args", type: "string", value: "<json>", description: "call/prompt: arguments as a JSON object" },
24
+ { name: "inventory", type: "string", value: "<digest>", description: "refuse before dispatch unless the live inventory has this digest" },
25
+ { name: "timeout", type: "string", value: "<ms>", description: "request deadline in milliseconds (default 30000, max 120000)" },
26
+ { name: "endpoint", type: "string", value: "<name>", description: "serve/caller: the reverse-DNS endpoint name, in a namespace you own" },
27
+ { name: "out", type: "string", value: "<path>", description: "caller: write the caller credential here (0600, never printed)" },
28
+ { name: "channels", type: "string", value: "<a,b>", description: "caller: channels the caller seat may read and post" },
29
+ { name: "expires-in", type: "string", value: "<s>", description: "caller: credential lifetime in seconds" },
30
+ spaceFlag,
31
+ serverFlag,
32
+ ],
33
+ run: linear,
34
+ };
35
+ registry.register(linearCommand);
36
+ export { LinearUpstream, DEFAULT_LIMITS } from "./upstream.js";
37
+ export { LINEAR_MCP_ORIGIN, LINEAR_MCP_PATHS, linearMcpUrl } from "./origin.js";
38
+ export { loadAccount } from "./account.js";
39
+ export { inventoryPage, linearClusterArtifacts, linearCommandDefs, linearContractArtifactValues, INVENTORY_PAGE_BYTES, INVENTORY_REPLY_MAX_BYTES, LINEAR_CAPABILITY, LINEAR_CLUSTER_URN, LINEAR_COMMANDS } from "./contract.js";
40
+ export { assertLinearEndpointName, linearCallerCapabilities, provisionLinearCaller, registerLinearEndpoint, renewalDelayMs, runLinearEndpoint, } from "./serve.js";
41
+ //# sourceMappingURL=index.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,QAAQ,EAAgB,MAAM,gBAAgB,CAAC;AACxD,OAAO,EAAE,UAAU,EAAE,SAAS,EAAE,MAAM,qBAAqB,CAAC;AAC5D,OAAO,EAAE,MAAM,EAAE,KAAK,EAAE,MAAM,UAAU,CAAC;AAEzC;;;;;GAKG;AACH,MAAM,aAAa,GAAY;IAC7B,IAAI,EAAE,SAAS;IACf,IAAI,EAAE,QAAQ;IACd,KAAK,EAAE,cAAc;IACrB,OAAO,EAAE,0FAA0F;IACnG,KAAK,EAAE,KAAK;IACZ,WAAW,EAAE,gBAAgB;IAC7B,iBAAiB,EAAE,KAAK;IACxB,KAAK,EAAE;QACL,EAAE,IAAI,EAAE,MAAM,EAAE,IAAI,EAAE,QAAQ,EAAE,KAAK,EAAE,kBAAkB,EAAE,WAAW,EAAE,uDAAuD,EAAE;QACjI,EAAE,IAAI,EAAE,aAAa,EAAE,IAAI,EAAE,SAAS,EAAE,WAAW,EAAE,2EAA2E,EAAE;QA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Aa,CAAC;AACjG,OAAO,EAAE,WAAW,EAAsB,MAAM,cAAc,CAAC;AAC/D,OAAO,EAAE,aAAa,EAAE,sBAAsB,EAAE,iBAAiB,EAAE,4BAA4B,EAAE,oBAAoB,EAAE,yBAAyB,EAAE,iBAAiB,EAAE,kBAAkB,EAAE,eAAe,EAAE,MAAM,eAAe,CAAC;AAChO,OAAO,EACL,wBAAwB,EACxB,wBAAwB,EACxB,qBAAqB,EACrB,sBAAsB,EACtB,cAAc,EACd,iBAAiB,GAIlB,MAAM,YAAY,CAAC"}
@@ -0,0 +1,12 @@
1
+ import { type LinearAccount } from "./account.js";
2
+ import { type LinearMode } from "./origin.js";
3
+ /** How an upstream session gets its bearer. `prepare` runs before discovery and before dispatch. */
4
+ export interface LinearCredential {
5
+ bearer(): string;
6
+ prepare(): Promise<void>;
7
+ }
8
+ export declare function scopeFor(mode: LinearMode): string;
9
+ /** Interactive login: loopback redirect, PKCE, dynamic registration. Saves an `oauth` account. */
10
+ export declare function loginAccount(name: string, mode: LinearMode): Promise<void>;
11
+ export declare function credentialFor(account: LinearAccount): LinearCredential;
12
+ //# sourceMappingURL=oauth.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"oauth.d.ts","sourceRoot":"","sources":["../src/oauth.ts"],"names":[],"mappings":"AAoBA,OAAO,EAA+E,KAAK,aAAa,EAAE,MAAM,cAAc,CAAC;AAC/H,OAAO,EAA8E,KAAK,UAAU,EAAE,MAAM,aAAa,CAAC;AAE1H,oGAAoG;AACpG,MAAM,WAAW,gBAAgB;IAC/B,MAAM,IAAI,MAAM,CAAC;IACjB,OAAO,IAAI,OAAO,CAAC,IAAI,CAAC,CAAC;CAC1B;AAeD,wBAAgB,QAAQ,CAAC,IAAI,EAAE,UAAU,GAAG,MAAM,CAEjD;AA4HD,kGAAkG;AAClG,wBAAsB,YAAY,CAAC,IAAI,EAAE,MAAM,EAAE,IAAI,EAAE,UAAU,GAAG,OAAO,CAAC,IAAI,CAAC,CAqDhF;AA4BD,wBAAgB,aAAa,CAAC,OAAO,EAAE,aAAa,GAAG,gBAAgB,CAGtE"}