@vellumai/assistant 0.10.9-staging.1 → 0.10.9-staging.2

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 (100) hide show
  1. package/AGENTS.md +4 -0
  2. package/knip.json +1 -4
  3. package/openapi.yaml +28 -18
  4. package/package.json +1 -1
  5. package/src/__tests__/always-loaded-tools-guard.test.ts +4 -6
  6. package/src/__tests__/app-routes-csp.test.ts +13 -4
  7. package/src/__tests__/conversation-tool-setup-tools-disabled.test.ts +4 -8
  8. package/src/__tests__/disk-pressure-tools.test.ts +4 -4
  9. package/src/__tests__/file-list-tool.test.ts +22 -12
  10. package/src/__tests__/list-all-apps.test.ts +204 -0
  11. package/src/__tests__/messaging-send-tool.test.ts +67 -0
  12. package/src/__tests__/mtime-cache.test.ts +42 -0
  13. package/src/__tests__/oauth-provider-profiles.test.ts +3 -2
  14. package/src/__tests__/outlook-messaging-provider.test.ts +71 -0
  15. package/src/__tests__/plugin-app-serve-routes.test.ts +163 -0
  16. package/src/__tests__/plugin-import-boundary-guard.test.ts +1 -0
  17. package/src/__tests__/scaffold-managed-skill-tool.test.ts +47 -0
  18. package/src/__tests__/subagent-notify-parent.test.ts +4 -3
  19. package/src/__tests__/subagent-tool-filtering.test.ts +21 -21
  20. package/src/__tests__/subagent-tool-gate-mode.test.ts +6 -6
  21. package/src/apps/app-store.ts +302 -2
  22. package/src/cli/AGENTS.md +17 -0
  23. package/src/cli/commands/__tests__/gateway.test.ts +55 -0
  24. package/src/cli/commands/apps.help.ts +17 -11
  25. package/src/cli/commands/apps.ts +5 -15
  26. package/src/cli/commands/gateway.help.ts +30 -0
  27. package/src/cli/commands/gateway.ts +40 -1
  28. package/src/cli/commands/platform/__tests__/status.test.ts +0 -90
  29. package/src/cli/commands/platform/index.help.ts +3 -2
  30. package/src/cli/commands/platform/index.ts +0 -9
  31. package/src/cli/commands/routes.help.ts +13 -7
  32. package/src/cli/commands/routes.ts +5 -3
  33. package/src/cli/commands/status.help.ts +24 -0
  34. package/src/cli/commands/status.ts +29 -0
  35. package/src/cli/lib/__tests__/global-json-option.test.ts +97 -0
  36. package/src/cli/lib/__tests__/plugin-catalog-local.test.ts +1 -0
  37. package/src/cli/lib/__tests__/plugin-fingerprint.test.ts +31 -0
  38. package/src/cli/lib/bundled-marketplace.json +187 -173
  39. package/src/cli/lib/global-json-option.ts +41 -0
  40. package/src/cli/lib/plugin-fingerprint.ts +18 -7
  41. package/src/cli/program.ts +5 -0
  42. package/src/config/bundled-skills/messaging/TOOLS.json +2 -2
  43. package/src/config/bundled-skills/messaging/tools/messaging-send.ts +27 -19
  44. package/src/config/bundled-skills/phone-calls/references/TROUBLESHOOTING.md +3 -3
  45. package/src/config/feature-flag-registry.json +1 -9
  46. package/src/daemon/__tests__/conversation-tool-setup-exclude.test.ts +3 -6
  47. package/src/daemon/__tests__/conversation-tool-setup-plugin-scope.test.ts +3 -6
  48. package/src/daemon/__tests__/conversation-tool-setup.test.ts +8 -5
  49. package/src/daemon/conversation-tool-setup.ts +5 -90
  50. package/src/daemon/conversation.ts +2 -2
  51. package/src/messaging/provider-types.ts +9 -0
  52. package/src/messaging/providers/outlook/adapter.ts +17 -2
  53. package/src/messaging/providers/outlook/client.ts +11 -2
  54. package/src/messaging/providers/outlook/types.ts +9 -0
  55. package/src/monitoring/__tests__/plugin-source-watch.test.ts +37 -0
  56. package/src/monitoring/plugin-source-watch.ts +53 -0
  57. package/src/oauth/seed-providers.ts +6 -0
  58. package/src/persistence/embeddings/__tests__/messages-lexical-index.test.ts +3 -0
  59. package/src/persistence/embeddings/messages-lexical-index.ts +11 -0
  60. package/src/plugin-api/conversation-turn.ts +234 -0
  61. package/src/plugin-api/index.ts +12 -0
  62. package/src/plugins/__tests__/source-fingerprint.test.ts +41 -0
  63. package/src/plugins/defaults/memory/__tests__/memory-retrospective-job.test.ts +48 -0
  64. package/src/plugins/defaults/memory/__tests__/memory-retrospective-skill-card.test.ts +46 -5
  65. package/src/plugins/defaults/memory/graph/tool-handlers.ts +2 -2
  66. package/src/plugins/defaults/memory/graph-topology/__tests__/build-memory-graph.test.ts +81 -2
  67. package/src/plugins/defaults/memory/graph-topology/build-memory-graph.ts +80 -33
  68. package/src/plugins/defaults/memory/memory-retrospective-job.ts +40 -1
  69. package/src/plugins/defaults/memory/memory-retrospective-skill-card.ts +28 -2
  70. package/src/plugins/mtime-cache.ts +26 -13
  71. package/src/plugins/plugin-tree-walk.ts +30 -0
  72. package/src/plugins/source-fingerprint.ts +9 -2
  73. package/src/plugins/surface-import.ts +28 -0
  74. package/src/providers/speech-to-text/__tests__/vellum-managed-realtime.test.ts +1 -1
  75. package/src/providers/speech-to-text/__tests__/vellum-speech-relay-connection.test.ts +4 -1
  76. package/src/providers/speech-to-text/vellum-speech-relay-connection.ts +5 -0
  77. package/src/runtime/routes/__tests__/gateway-status-routes.test.ts +84 -0
  78. package/src/runtime/routes/__tests__/plugins-routes.test.ts +47 -3
  79. package/src/runtime/routes/__tests__/user-routes-cli.test.ts +154 -0
  80. package/src/runtime/routes/app-management-routes.ts +96 -32
  81. package/src/runtime/routes/app-routes.ts +33 -17
  82. package/src/runtime/routes/gateway-status-routes.ts +69 -0
  83. package/src/runtime/routes/index.ts +2 -0
  84. package/src/runtime/routes/platform-routes.ts +4 -14
  85. package/src/runtime/routes/plugins-routes.ts +58 -1
  86. package/src/runtime/routes/settings-routes.ts +8 -6
  87. package/src/runtime/routes/user-route-dispatcher.ts +6 -86
  88. package/src/runtime/routes/user-route-resolution.ts +141 -0
  89. package/src/runtime/routes/user-routes-cli.ts +56 -35
  90. package/src/telemetry/AGENTS.md +15 -0
  91. package/src/telemetry/__tests__/telemetry-event-fixtures.ts +258 -0
  92. package/src/telemetry/telemetry-wire-source.json +1 -1
  93. package/src/telemetry/telemetry-wire-validation.test.ts +157 -0
  94. package/src/telemetry/telemetry-wire-validation.ts +125 -0
  95. package/src/telemetry/telemetry-wire.generated.ts +60 -9
  96. package/src/telemetry/types.test.ts +38 -0
  97. package/src/telemetry/types.ts +183 -91
  98. package/src/telemetry/usage-telemetry-reporter.ts +5 -0
  99. package/src/telemetry/watchdog-direct-emit.ts +6 -0
  100. package/src/tools/skills/scaffold-managed.ts +43 -11
@@ -12,11 +12,15 @@ import {
12
12
  createManagedSkill,
13
13
  getManagedSkillDir,
14
14
  } from "../../skills/managed-store.js";
15
+ import { recordWatchdogEvent } from "../../telemetry/watchdog-events-store.js";
15
16
  import { getLogger } from "../../util/logger.js";
16
17
  import type { ToolContext, ToolExecutionResult } from "../types.js";
17
18
 
18
19
  const log = getLogger("scaffold-managed-skill");
19
20
 
21
+ /** Watchdog check_name for the per-creation skill-authoring counter. */
22
+ const SKILL_AUTHORED_CHECK_NAME = "skill_authored";
23
+
20
24
  /** Strip embedded newlines/carriage returns to prevent YAML frontmatter injection. */
21
25
  function sanitizeFrontmatterValue(value: string): string {
22
26
  return value.replace(/[\r\n]+/g, " ").trim();
@@ -37,7 +41,9 @@ function normalizeOptionalStringArray(
37
41
  raw: unknown,
38
42
  field: string,
39
43
  ): { value?: string[]; error?: string } {
40
- if (raw === undefined) return {};
44
+ if (raw === undefined) {
45
+ return {};
46
+ }
41
47
  if (!Array.isArray(raw)) {
42
48
  return { error: `${field} must be an array of strings` };
43
49
  }
@@ -51,7 +57,9 @@ function normalizeOptionalStringArray(
51
57
  if (!cleaned) {
52
58
  return { error: `each element in ${field} must be a non-empty string` };
53
59
  }
54
- if (seen.has(cleaned)) continue;
60
+ if (seen.has(cleaned)) {
61
+ continue;
62
+ }
55
63
  seen.add(cleaned);
56
64
  normalized.push(cleaned);
57
65
  }
@@ -199,12 +207,14 @@ export async function executeScaffoldManagedSkill(
199
207
  context.requestOrigin === MEMORY_RETROSPECTIVE_ORIGIN;
200
208
  const author = fromRetrospective ? "assistant" : "user";
201
209
 
202
- // Whether a managed SKILL.md already existed before this call. Resolved for
203
- // retrospective calls only it drives both the ownership backstop below and
204
- // the created-vs-refined discriminant for the skill-card enqueue: only a
205
- // genuine CREATE (no pre-existing skill, regardless of the `overwrite` flag)
206
- // gets a card.
207
- let managedSkillExistedBefore = false;
210
+ // Whether a managed SKILL.md already existed before this call. Drives the
211
+ // ownership backstop below, the created-vs-refined discriminant for the
212
+ // skill-card enqueue, and the `skill_authored` telemetry counter: only a
213
+ // genuine CREATE (no pre-existing skill, regardless of the `overwrite`
214
+ // flag) gets a card or a counter event.
215
+ const managedSkillExistedBefore = existsSync(
216
+ join(getManagedSkillDir(id), "SKILL.md"),
217
+ );
208
218
 
209
219
  // Ownership backstop (retrospective origin only): the retrospective may author
210
220
  // a skill ONLY if it owns it. Fail closed on either of two collisions.
@@ -234,11 +244,9 @@ export async function executeScaffoldManagedSkill(
234
244
  // exactly "assistant". This fails closed on user-authored, untagged, and
235
245
  // unverifiable (missing/corrupt meta) managed skills alike, matching the
236
246
  // prune side where such skills are never pruned.
237
- const managedDir = getManagedSkillDir(id);
238
- managedSkillExistedBefore = existsSync(join(managedDir, "SKILL.md"));
239
247
  if (
240
248
  managedSkillExistedBefore &&
241
- readInstallMeta(managedDir)?.author !== "assistant"
249
+ readInstallMeta(getManagedSkillDir(id))?.author !== "assistant"
242
250
  ) {
243
251
  return {
244
252
  content: `Error: skill "${id}" is not verifiably assistant-authored; the retrospective may not overwrite it or write companion files into it. Author a new skill instead.`,
@@ -298,6 +306,30 @@ export async function executeScaffoldManagedSkill(
298
306
 
299
307
  refreshSkillCapabilityMemories();
300
308
 
309
+ // Central adoption counter for skill authoring (admin analytics groups on
310
+ // the watchdog check_name). Genuine creates only — refinements of a
311
+ // pre-existing skill are not new capabilities and would double-count.
312
+ // `authored_by` distinguishes proactive retrospective authoring from
313
+ // user-directed scaffolds; the skill id itself stays out of the detail
314
+ // bag — ids derive from user/model content (a name can encode a
315
+ // customer or procedure), and watchdog events are metadata-only with no
316
+ // deletion-redaction tie to the source conversation. Never throws: a
317
+ // telemetry failure must not fail a scaffold that already succeeded.
318
+ if (!managedSkillExistedBefore) {
319
+ try {
320
+ recordWatchdogEvent({
321
+ checkName: SKILL_AUTHORED_CHECK_NAME,
322
+ value: 1,
323
+ detail: {
324
+ authored_by: fromRetrospective ? "retrospective" : "user",
325
+ },
326
+ });
327
+ } catch {
328
+ // recordWatchdogEvent already no-ops on opt-out and a missing
329
+ // telemetry DB; anything past that is not worth surfacing here.
330
+ }
331
+ }
332
+
301
333
  // Surface a genuine retrospective CREATE to the user as a skill card on the
302
334
  // source conversation, via the durable `skill_card_insert` delivery job
303
335
  // (memory-retrospective-skill-card.ts). The creation site is the one place