@llamaventures/cli 1.18.1 → 1.20.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,342 @@
1
+ {
2
+ "format": "llama.cli-core-api-operations.v1",
3
+ "coreApiContract": "contracts/core-api.json",
4
+ "requiredOperations": [
5
+ {
6
+ "method": "GET",
7
+ "path": "/api/admin/agent-events"
8
+ },
9
+ {
10
+ "method": "GET",
11
+ "path": "/api/admin/auth-events"
12
+ },
13
+ {
14
+ "method": "GET",
15
+ "path": "/api/admin/deal-events"
16
+ },
17
+ {
18
+ "method": "GET",
19
+ "path": "/api/agent/activity"
20
+ },
21
+ {
22
+ "method": "GET",
23
+ "path": "/api/agent/briefing"
24
+ },
25
+ {
26
+ "method": "POST",
27
+ "path": "/api/agent/client-events"
28
+ },
29
+ {
30
+ "method": "GET",
31
+ "path": "/api/agent/explain"
32
+ },
33
+ {
34
+ "method": "GET",
35
+ "path": "/api/agent/manifest"
36
+ },
37
+ {
38
+ "method": "GET",
39
+ "path": "/api/agent/preferences"
40
+ },
41
+ {
42
+ "method": "POST",
43
+ "path": "/api/agent/preferences"
44
+ },
45
+ {
46
+ "method": "PATCH",
47
+ "path": "/api/agent/preferences/{id}"
48
+ },
49
+ {
50
+ "method": "GET",
51
+ "path": "/api/agent/skills"
52
+ },
53
+ {
54
+ "method": "GET",
55
+ "path": "/api/agent/skills/{slug}"
56
+ },
57
+ {
58
+ "method": "GET",
59
+ "path": "/api/deals"
60
+ },
61
+ {
62
+ "method": "POST",
63
+ "path": "/api/deals/create"
64
+ },
65
+ {
66
+ "method": "GET",
67
+ "path": "/api/deals/deleted"
68
+ },
69
+ {
70
+ "method": "POST",
71
+ "path": "/api/deals/update"
72
+ },
73
+ {
74
+ "method": "DELETE",
75
+ "path": "/api/deals/{dealId}"
76
+ },
77
+ {
78
+ "method": "GET",
79
+ "path": "/api/deals/{dealId}"
80
+ },
81
+ {
82
+ "method": "POST",
83
+ "path": "/api/deals/{dealId}/agent-runs/{runId}/revert"
84
+ },
85
+ {
86
+ "method": "GET",
87
+ "path": "/api/deals/{dealId}/blocks"
88
+ },
89
+ {
90
+ "method": "PUT",
91
+ "path": "/api/deals/{dealId}/blocks"
92
+ },
93
+ {
94
+ "method": "DELETE",
95
+ "path": "/api/deals/{dealId}/blocks/{blockId}"
96
+ },
97
+ {
98
+ "method": "GET",
99
+ "path": "/api/deals/{dealId}/blocks/{blockId}"
100
+ },
101
+ {
102
+ "method": "PATCH",
103
+ "path": "/api/deals/{dealId}/blocks/{blockId}"
104
+ },
105
+ {
106
+ "method": "GET",
107
+ "path": "/api/deals/{dealId}/blocks/{blockId}/history"
108
+ },
109
+ {
110
+ "method": "POST",
111
+ "path": "/api/deals/{dealId}/blocks/{blockId}/history"
112
+ },
113
+ {
114
+ "method": "POST",
115
+ "path": "/api/deals/{dealId}/blocks/{blockId}/restore"
116
+ },
117
+ {
118
+ "method": "GET",
119
+ "path": "/api/deals/{dealId}/collaborators"
120
+ },
121
+ {
122
+ "method": "POST",
123
+ "path": "/api/deals/{dealId}/collaborators"
124
+ },
125
+ {
126
+ "method": "DELETE",
127
+ "path": "/api/deals/{dealId}/collaborators/{userId}"
128
+ },
129
+ {
130
+ "method": "POST",
131
+ "path": "/api/deals/{dealId}/collaborators/{userId}/restore"
132
+ },
133
+ {
134
+ "method": "GET",
135
+ "path": "/api/deals/{dealId}/command-center"
136
+ },
137
+ {
138
+ "method": "GET",
139
+ "path": "/api/deals/{dealId}/documents"
140
+ },
141
+ {
142
+ "method": "POST",
143
+ "path": "/api/deals/{dealId}/documents"
144
+ },
145
+ {
146
+ "method": "DELETE",
147
+ "path": "/api/deals/{dealId}/documents/{slug}"
148
+ },
149
+ {
150
+ "method": "PATCH",
151
+ "path": "/api/deals/{dealId}/documents/{slug}"
152
+ },
153
+ {
154
+ "method": "DELETE",
155
+ "path": "/api/deals/{dealId}/documents/{slug}/html"
156
+ },
157
+ {
158
+ "method": "GET",
159
+ "path": "/api/deals/{dealId}/documents/{slug}/html"
160
+ },
161
+ {
162
+ "method": "PUT",
163
+ "path": "/api/deals/{dealId}/documents/{slug}/html"
164
+ },
165
+ {
166
+ "method": "GET",
167
+ "path": "/api/deals/{dealId}/documents/{slug}/html/history"
168
+ },
169
+ {
170
+ "method": "POST",
171
+ "path": "/api/deals/{dealId}/documents/{slug}/html/restore/{version}"
172
+ },
173
+ {
174
+ "method": "POST",
175
+ "path": "/api/deals/{dealId}/enrich"
176
+ },
177
+ {
178
+ "method": "GET",
179
+ "path": "/api/deals/{dealId}/facts"
180
+ },
181
+ {
182
+ "method": "POST",
183
+ "path": "/api/deals/{dealId}/facts"
184
+ },
185
+ {
186
+ "method": "PATCH",
187
+ "path": "/api/deals/{dealId}/facts/{factId}"
188
+ },
189
+ {
190
+ "method": "GET",
191
+ "path": "/api/deals/{dealId}/feed"
192
+ },
193
+ {
194
+ "method": "PUT",
195
+ "path": "/api/deals/{dealId}/founders"
196
+ },
197
+ {
198
+ "method": "POST",
199
+ "path": "/api/deals/{dealId}/ingest"
200
+ },
201
+ {
202
+ "method": "GET",
203
+ "path": "/api/deals/{dealId}/links"
204
+ },
205
+ {
206
+ "method": "POST",
207
+ "path": "/api/deals/{dealId}/links"
208
+ },
209
+ {
210
+ "method": "DELETE",
211
+ "path": "/api/deals/{dealId}/links/{linkId}"
212
+ },
213
+ {
214
+ "method": "POST",
215
+ "path": "/api/deals/{dealId}/links/{linkId}/restore"
216
+ },
217
+ {
218
+ "method": "DELETE",
219
+ "path": "/api/deals/{dealId}/memo"
220
+ },
221
+ {
222
+ "method": "GET",
223
+ "path": "/api/deals/{dealId}/memo"
224
+ },
225
+ {
226
+ "method": "POST",
227
+ "path": "/api/deals/{dealId}/memo"
228
+ },
229
+ {
230
+ "method": "PUT",
231
+ "path": "/api/deals/{dealId}/memo"
232
+ },
233
+ {
234
+ "method": "POST",
235
+ "path": "/api/deals/{dealId}/posts"
236
+ },
237
+ {
238
+ "method": "POST",
239
+ "path": "/api/deals/{dealId}/propose-owner"
240
+ },
241
+ {
242
+ "method": "POST",
243
+ "path": "/api/deals/{dealId}/refresh-brief"
244
+ },
245
+ {
246
+ "method": "POST",
247
+ "path": "/api/deals/{dealId}/restore"
248
+ },
249
+ {
250
+ "method": "POST",
251
+ "path": "/api/deals/{dealId}/threads"
252
+ },
253
+ {
254
+ "method": "POST",
255
+ "path": "/api/deals/{dealId}/threads/{threadId}"
256
+ },
257
+ {
258
+ "method": "GET",
259
+ "path": "/api/deals/{dealId}/timeline"
260
+ },
261
+ {
262
+ "method": "POST",
263
+ "path": "/api/external/chat"
264
+ },
265
+ {
266
+ "method": "POST",
267
+ "path": "/api/external/start-session"
268
+ },
269
+ {
270
+ "method": "POST",
271
+ "path": "/api/external/upload"
272
+ },
273
+ {
274
+ "method": "GET",
275
+ "path": "/api/me"
276
+ },
277
+ {
278
+ "method": "GET",
279
+ "path": "/api/me/nominations"
280
+ },
281
+ {
282
+ "method": "GET",
283
+ "path": "/api/mentions"
284
+ },
285
+ {
286
+ "method": "GET",
287
+ "path": "/api/mentions/unread-count"
288
+ },
289
+ {
290
+ "method": "POST",
291
+ "path": "/api/mentions/{id}/resolve"
292
+ },
293
+ {
294
+ "method": "POST",
295
+ "path": "/api/nominations/{approvalId}"
296
+ },
297
+ {
298
+ "method": "GET",
299
+ "path": "/api/oauth/authorize"
300
+ },
301
+ {
302
+ "method": "POST",
303
+ "path": "/api/oauth/revoke"
304
+ },
305
+ {
306
+ "method": "POST",
307
+ "path": "/api/oauth/token"
308
+ },
309
+ {
310
+ "method": "GET",
311
+ "path": "/api/partner/approvals"
312
+ },
313
+ {
314
+ "method": "POST",
315
+ "path": "/api/partner/approvals"
316
+ },
317
+ {
318
+ "method": "GET",
319
+ "path": "/api/users"
320
+ },
321
+ {
322
+ "method": "POST",
323
+ "path": "/api/wiki/save"
324
+ },
325
+ {
326
+ "method": "GET",
327
+ "path": "/api/wiki/search"
328
+ },
329
+ {
330
+ "method": "DELETE",
331
+ "path": "/api/wiki/{slug}"
332
+ },
333
+ {
334
+ "method": "GET",
335
+ "path": "/api/wiki/{slug}"
336
+ },
337
+ {
338
+ "method": "POST",
339
+ "path": "/api/wiki/{slug}/restore"
340
+ }
341
+ ]
342
+ }
@@ -0,0 +1,34 @@
1
+ import { createRequire } from "node:module";
2
+
3
+ const requireFromHere = createRequire(import.meta.url);
4
+
5
+ function readJson(relativePath) {
6
+ try {
7
+ return requireFromHere(relativePath);
8
+ } catch {
9
+ return null;
10
+ }
11
+ }
12
+
13
+ export function getBuildInfo() {
14
+ const built = readJson("./build-manifest.json");
15
+ if (built) return built;
16
+
17
+ const packageJson = readJson("../package.json") || {};
18
+ const contract = readJson("../contracts/core-api.json") || {};
19
+ return {
20
+ format: "llama.cli-build.v1",
21
+ packageName: packageJson.name || "@llamaventures/cli",
22
+ packageVersion: packageJson.version || "unknown",
23
+ sourceSha: "local/unknown",
24
+ sourceKind: "local",
25
+ sourceDirty: null,
26
+ coreApiContract: {
27
+ format: contract.format || "unknown",
28
+ name: contract.name || "llama-core-api",
29
+ apiVersion: contract.apiVersion || "unknown",
30
+ openapiVersion: contract.openapiVersion || "unknown",
31
+ sha256: contract.sha256 || "unknown",
32
+ },
33
+ };
34
+ }
@@ -0,0 +1,15 @@
1
+ {
2
+ "format": "llama.cli-build.v1",
3
+ "packageName": "@llamaventures/cli",
4
+ "packageVersion": "1.20.0",
5
+ "sourceSha": "c9708c7ae6881e9e4a82972a521e748932a380ce",
6
+ "sourceKind": "github",
7
+ "sourceDirty": false,
8
+ "coreApiContract": {
9
+ "format": "llama.core-api-contract.v1",
10
+ "name": "llama-core-api",
11
+ "apiVersion": "3.1.0",
12
+ "openapiVersion": "3.0.3",
13
+ "sha256": "51b134af7a63534406b3a216aeab190fd595f5270b2a10263730662f1c2f771a"
14
+ }
15
+ }
package/lib/client.mjs CHANGED
@@ -14,6 +14,7 @@ import { fileURLToPath } from "url";
14
14
  import { execFile as _execFile } from "child_process";
15
15
  import { promisify } from "util";
16
16
  import { createHash, randomUUID } from "crypto";
17
+ import { getBuildInfo } from "./build-info.mjs";
17
18
 
18
19
  const execFile = promisify(_execFile);
19
20
 
@@ -197,7 +198,6 @@ function rememberAgentEvent(event) {
197
198
  ...readAgentSession(),
198
199
  sessionId: event.sessionId || currentAgentSessionId(),
199
200
  lastEventId: event.eventId,
200
- lastCandidateId: event.candidateId ?? null,
201
201
  lastCommand: event.command ?? null,
202
202
  lastQuery: event.query ?? null,
203
203
  lastSurface: event.surface ?? null,
@@ -207,9 +207,13 @@ function rememberAgentEvent(event) {
207
207
  }
208
208
 
209
209
  function agentClientHeaders(command) {
210
+ const build = getBuildInfo();
210
211
  return {
211
212
  "X-Llama-Client": runtimeClient,
212
213
  "X-Llama-Client-Version": getPackageVersion(),
214
+ "X-Llama-Client-Source-Sha": build.sourceSha,
215
+ "X-Llama-API-Contract-Version": build.coreApiContract.apiVersion,
216
+ "X-Llama-API-Contract-Digest": build.coreApiContract.sha256,
213
217
  "X-Llama-Agent-Client": detectAgentClient(),
214
218
  "X-Llama-Agent-Session": currentAgentSessionId(),
215
219
  "X-Llama-Command": command || "unknown",
@@ -288,6 +292,7 @@ function inferCommand(method, endpoint) {
288
292
  if (pathname === "/api/deals") return verb === "GET" ? "deal.search" : "deal.write";
289
293
  if (pathname === "/api/deals/create") return "deal.create";
290
294
  if (pathname === "/api/deals/update") return "deal.update";
295
+ if (/^\/api\/deals\/[^/]+\/ingest$/.test(pathname)) return "deal.ingest";
291
296
  if (/^\/api\/deals\/[^/]+\/threads\/[^/]+$/.test(pathname)) return "deal.agent.run";
292
297
  if (/^\/api\/deals\/[^/]+\/threads$/.test(pathname)) return "deal.thread.create";
293
298
  if (/^\/api\/deals\/[^/]+\/facts/.test(pathname)) return verb === "GET" ? "deal.fact.list" : "deal.fact.write";
@@ -173,6 +173,7 @@ export async function pkceLoopbackFlow({ baseUrl, scope, resource }) {
173
173
  });
174
174
 
175
175
  // Build authorize URL and open browser.
176
+ // @core-api-operation GET /api/oauth/authorize
176
177
  const authorizeUrl = new URL(`${baseUrl}/api/oauth/authorize`);
177
178
  authorizeUrl.searchParams.set("response_type", "code");
178
179
  authorizeUrl.searchParams.set("client_id", CLIENT_ID);
@@ -73,6 +73,7 @@ async function fetchLatest() {
73
73
  // The /latest convenience endpoint returns full JSON under the default
74
74
  // Accept. (The abbreviated "vnd.npm.install-v1+json" metadata type is only
75
75
  // valid on the full packument endpoint — it 406s here.)
76
+ // @core-api-ignore external npm registry version check
76
77
  const res = await fetch(REGISTRY_URL, { signal: controller.signal });
77
78
  if (!res.ok) return null;
78
79
  const data = await res.json();
package/package.json CHANGED
@@ -1,12 +1,16 @@
1
1
  {
2
2
  "name": "@llamaventures/cli",
3
- "version": "1.18.1",
3
+ "version": "1.20.0",
4
4
  "description": "CLI + MCP server for the Llama Ventures investment workbench (command.llamaventures.vc).",
5
5
  "type": "module",
6
6
  "scripts": {
7
- "test": "npm run test:agent-routing",
7
+ "test": "npm run test:agent-routing && npm run test:contract",
8
8
  "test:agent-routing": "node scripts/verify-agent-routing.mjs",
9
- "verify:release": "npm test && node scripts/verify-tarball-clean.mjs && npm pack --dry-run"
9
+ "test:contract": "node --test scripts/build-manifest.test.mjs scripts/core-api-call-sites.test.mjs scripts/verify-core-api-contract.test.mjs && node scripts/verify-core-api-contract.mjs",
10
+ "verify:artifact": "node scripts/verify-release-artifact.mjs",
11
+ "verify:release": "npm test && npm run verify:artifact && node scripts/verify-tarball-clean.mjs",
12
+ "prepack": "node scripts/prepare-build-manifest.mjs",
13
+ "postpack": "node scripts/cleanup-build-manifest.mjs"
10
14
  },
11
15
  "bin": {
12
16
  "llama": "bin/llama.mjs",
@@ -14,6 +18,7 @@
14
18
  },
15
19
  "files": [
16
20
  "bin/",
21
+ "contracts/",
17
22
  "lib/",
18
23
  "AGENT_BRIEFING.md",
19
24
  "CHANGELOG.md",