@vellumai/credential-executor 0.10.7-dev.202607102035.64f07ea → 0.10.7-staging.1

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 (65) hide show
  1. package/Dockerfile +1 -1
  2. package/node_modules/@vellumai/service-contracts/package.json +2 -1
  3. package/node_modules/@vellumai/service-contracts/src/__tests__/contracts.test.ts +2 -0
  4. package/node_modules/@vellumai/service-contracts/src/__tests__/grants.test.ts +686 -0
  5. package/node_modules/@vellumai/service-contracts/src/credential-rpc.ts +5 -3
  6. package/node_modules/@vellumai/service-contracts/src/grants.ts +184 -0
  7. package/node_modules/@vellumai/service-contracts/src/index.ts +4 -2
  8. package/node_modules/@vellumai/service-contracts/src/rendering.ts +135 -0
  9. package/node_modules/@vellumai/service-contracts/src/rpc.ts +447 -4
  10. package/package.json +3 -2
  11. package/src/__tests__/bulk-set-credentials.test.ts +1 -1
  12. package/src/__tests__/command-executor.test.ts +1879 -0
  13. package/src/__tests__/command-validator.test.ts +1405 -0
  14. package/src/__tests__/command-workspace.test.ts +1050 -0
  15. package/src/__tests__/grant-store.test.ts +689 -0
  16. package/src/__tests__/http-executor.test.ts +1336 -0
  17. package/src/__tests__/http-policy.test.ts +1069 -0
  18. package/src/__tests__/local-materializers.test.ts +860 -0
  19. package/src/__tests__/local-standalone.test.ts +36 -5
  20. package/src/__tests__/local-token-refresh.test.ts +361 -0
  21. package/src/__tests__/manage-secure-command-tool.test.ts +134 -0
  22. package/src/__tests__/managed-integration.test.ts +91 -112
  23. package/src/__tests__/managed-lazy-getters.test.ts +359 -0
  24. package/src/__tests__/managed-materializers.test.ts +1028 -0
  25. package/src/__tests__/managed-reconnect.test.ts +2 -2
  26. package/src/__tests__/managed-rejection.test.ts +43 -0
  27. package/src/__tests__/toolstore.test.ts +773 -0
  28. package/src/__tests__/transport.test.ts +27 -23
  29. package/src/audit/store.ts +188 -0
  30. package/src/cli.ts +1 -1
  31. package/src/commands/auth-adapters.ts +169 -0
  32. package/src/commands/egress-hooks.ts +203 -0
  33. package/src/commands/executor.ts +1155 -0
  34. package/src/commands/output-scan.ts +157 -0
  35. package/src/commands/profiles.ts +286 -0
  36. package/src/commands/validator.ts +702 -0
  37. package/src/commands/workspace.ts +550 -0
  38. package/src/grants/index.ts +17 -0
  39. package/src/grants/persistent-store.ts +309 -0
  40. package/src/grants/rpc-handlers.ts +293 -0
  41. package/src/grants/temporary-store.ts +289 -0
  42. package/src/http/audit.ts +84 -0
  43. package/src/http/executor.ts +684 -0
  44. package/src/http/path-template.ts +245 -0
  45. package/src/http/policy.ts +238 -0
  46. package/src/http/response-filter.ts +233 -0
  47. package/src/index.ts +88 -8
  48. package/src/main.ts +340 -228
  49. package/src/managed-errors.ts +9 -0
  50. package/src/managed-lazy-getters.ts +106 -0
  51. package/src/managed-main.ts +822 -0
  52. package/src/materializers/local-oauth-lookup.ts +98 -0
  53. package/src/materializers/local-token-refresh.ts +287 -0
  54. package/src/materializers/local.ts +316 -0
  55. package/src/materializers/managed-platform.ts +295 -0
  56. package/src/paths.ts +20 -4
  57. package/src/server.ts +469 -52
  58. package/src/subjects/local.ts +177 -0
  59. package/src/subjects/managed.ts +311 -0
  60. package/src/subjects/policy.ts +79 -0
  61. package/src/toolstore/integrity.ts +94 -0
  62. package/src/toolstore/manifest.ts +154 -0
  63. package/src/toolstore/publish.ts +571 -0
  64. package/node_modules/@vellumai/service-contracts/src/__tests__/attachment-naming.test.ts +0 -104
  65. package/node_modules/@vellumai/service-contracts/src/attachment-naming.ts +0 -118
@@ -1,118 +0,0 @@
1
- /**
2
- * Attachment filename contract shared by the daemon (which materializes
3
- * `vellum://` links and `<vellum-attachment>` directives into stored
4
- * attachments) and the web client (which resolves clicked links back to
5
- * those attachments). Both sides must agree on the stored filename, so the
6
- * naming rule lives here once.
7
- */
8
-
9
- const EXTENSION_MIME_MAP: Record<string, string> = {
10
- // Images
11
- png: "image/png",
12
- jpg: "image/jpeg",
13
- jpeg: "image/jpeg",
14
- gif: "image/gif",
15
- webp: "image/webp",
16
- svg: "image/svg+xml",
17
- ico: "image/x-icon",
18
- bmp: "image/bmp",
19
- heic: "image/heic",
20
- heif: "image/heif",
21
-
22
- // Documents
23
- pdf: "application/pdf",
24
- json: "application/json",
25
- xml: "application/xml",
26
- csv: "text/csv",
27
- txt: "text/plain",
28
- md: "text/markdown",
29
- html: "text/html",
30
- css: "text/css",
31
- js: "text/javascript",
32
- ts: "text/typescript",
33
-
34
- // Audio
35
- mp3: "audio/mpeg",
36
- wav: "audio/wav",
37
- ogg: "audio/ogg",
38
- flac: "audio/flac",
39
- aac: "audio/aac",
40
- m4a: "audio/x-m4a",
41
- opus: "audio/opus",
42
-
43
- // Video
44
- mp4: "video/mp4",
45
- webm: "video/webm",
46
- mov: "video/quicktime",
47
- mpeg: "video/mpeg",
48
-
49
- // Archives
50
- zip: "application/zip",
51
- gz: "application/gzip",
52
- tar: "application/x-tar",
53
- };
54
-
55
- /**
56
- * Infer a MIME type from a filename extension.
57
- * Returns `application/octet-stream` when the extension is unrecognised.
58
- */
59
- export function inferMimeType(filename: string): string {
60
- const dot = filename.lastIndexOf(".");
61
- if (dot === -1) {
62
- return "application/octet-stream";
63
- }
64
- const ext = filename.slice(dot + 1).toLowerCase();
65
- return EXTENSION_MIME_MAP[ext] ?? "application/octet-stream";
66
- }
67
-
68
- /**
69
- * Pick the stored attachment filename for a materialized file directive.
70
- *
71
- * Explicit filenames (`<vellum-attachment filename="..." />` attributes)
72
- * are an authoring contract and always used verbatim. Link display text
73
- * (`[label](vellum://...)`) is cosmetic: it is only honored as the filename
74
- * when it carries a recognized extension. A bare label
75
- * (e.g. `[desktop](vellum://.../shot.png)`) would otherwise produce an
76
- * extensionless download with an `application/octet-stream` MIME type,
77
- * which macOS opens as raw text. In that case the label keeps the path's
78
- * extension (`desktop.png`), staying unique per link even when several
79
- * links share a basename; the raw basename is the last resort.
80
- *
81
- * The basename fallback splits on both `/` and `\\` so it handles POSIX
82
- * sandbox paths, `vellum://` URL paths, and Windows host paths alike.
83
- * Splitting on both separators regardless of the runtime platform also
84
- * covers Windows host paths resolved by a non-Windows daemon, which
85
- * platform-selected `node:path` semantics cannot.
86
- */
87
- export function resolveAttachmentFilename(
88
- preferred: string | undefined,
89
- resolvedPath: string,
90
- filenameSource: "explicit" | "label" = "explicit",
91
- ): string {
92
- const fallback =
93
- resolvedPath.split(/[\\/]/).filter(Boolean).pop() ?? resolvedPath;
94
- if (!preferred) {
95
- return fallback;
96
- }
97
- if (filenameSource === "explicit") {
98
- return preferred;
99
- }
100
- if (inferMimeType(preferred) !== "application/octet-stream") {
101
- return preferred;
102
- }
103
- // Bare label: keep the label as a per-link disambiguator (two links to
104
- // different files sharing a basename must not collide, because the
105
- // transcript resolves clicks by filename) and append the path's
106
- // extension so the stored name carries the correct type. Skip the
107
- // append when the label already ends with that extension (a label like
108
- // `report.xlsx` for `report.xlsx` must not become `report.xlsx.xlsx`).
109
- const dot = fallback.lastIndexOf(".");
110
- if (dot > 0 && dot < fallback.length - 1) {
111
- const ext = fallback.slice(dot + 1);
112
- if (preferred.toLowerCase().endsWith(`.${ext.toLowerCase()}`)) {
113
- return preferred;
114
- }
115
- return `${preferred}.${ext}`;
116
- }
117
- return fallback;
118
- }