@app-vitals/agent-lib 1.8.0 → 1.10.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,25 @@
1
+ /**
2
+ * lib/default-plugins.ts
3
+ *
4
+ * Plugins every newly created platform agent gets installed, whatever its
5
+ * specialty. The baked marketplace only makes a plugin available; the
6
+ * AgentPlugin rows decide what is installed. Seeded on create only, so
7
+ * existing agents are unchanged.
8
+ */
9
+
10
+ /** `<plugin>@<marketplace>`: the platform's own baked marketplace plugin. */
11
+ export const AGENT_PLATFORM_PLUGIN = "agent-platform@app-vitals-agent";
12
+
13
+ export const DEFAULT_PLATFORM_PLUGINS: readonly string[] = [
14
+ AGENT_PLATFORM_PLUGIN,
15
+ ];
16
+
17
+ /**
18
+ * The create-time plugin set: the platform defaults followed by any
19
+ * extension-supplied plugins, deduped, order preserved.
20
+ */
21
+ export function resolveDefaultPlugins(
22
+ extensionPlugins: readonly string[] = [],
23
+ ): string[] {
24
+ return [...new Set([...DEFAULT_PLATFORM_PLUGINS, ...extensionPlugins])];
25
+ }
@@ -0,0 +1,25 @@
1
+ import { describe, expect, it } from "bun:test";
2
+ import {
3
+ AGENT_PLATFORM_PLUGIN,
4
+ resolveDefaultPlugins,
5
+ } from "./default-plugins.ts";
6
+
7
+ describe("resolveDefaultPlugins", () => {
8
+ it("returns the platform default when no extension plugins are given", () => {
9
+ expect(resolveDefaultPlugins()).toEqual([AGENT_PLATFORM_PLUGIN]);
10
+ });
11
+
12
+ it("appends extension plugins after the platform default", () => {
13
+ expect(resolveDefaultPlugins(["ext@market"])).toEqual([
14
+ AGENT_PLATFORM_PLUGIN,
15
+ "ext@market",
16
+ ]);
17
+ });
18
+
19
+ it("dedupes an extension that also lists the platform plugin", () => {
20
+ expect(resolveDefaultPlugins([AGENT_PLATFORM_PLUGIN, "x@y"])).toEqual([
21
+ AGENT_PLATFORM_PLUGIN,
22
+ "x@y",
23
+ ]);
24
+ });
25
+ });
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@app-vitals/agent-lib",
3
- "version": "1.8.0",
3
+ "version": "1.10.0",
4
4
  "repository": {
5
5
  "type": "git",
6
6
  "url": "git+https://github.com/app-vitals/agent.git",
@@ -29,6 +29,7 @@
29
29
  "./request-context": "./request-context.ts",
30
30
  "./secret-env-vars": "./secret-env-vars.ts",
31
31
  "./default-agent-env": "./default-agent-env.ts",
32
+ "./default-plugins": "./default-plugins.ts",
32
33
  "./default-specialty": "./default-specialty.ts",
33
34
  "./specialist-type": "./specialist-type.ts",
34
35
  "./sentry": "./sentry.ts",