@roarkanalytics/sdk 5.12.0 → 5.14.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.
package/CHANGELOG.md CHANGED
@@ -1,5 +1,24 @@
1
1
  # Changelog
2
2
 
3
+ ## [5.14.0](https://github.com/roarkhq/sdk-roark-analytics-node/compare/v5.13.0...v5.14.0) (2026-10-24)
4
+
5
+
6
+ ### Features
7
+
8
+ * **api:** api update ([#1376](https://github.com/roarkhq/sdk-roark-analytics-node/issues/1376)) ([063eb87](https://github.com/roarkhq/sdk-roark-analytics-node/commit/063eb878de49ddacafbc1e7f58966ad6765efb5e))
9
+
10
+
11
+ ### Chores
12
+
13
+ * fold next into main ([b58fee9](https://github.com/roarkhq/sdk-roark-analytics-node/commit/b58fee9c5803434a174306fdc838d4bb85a66999))
14
+
15
+ ## [5.13.0](https://github.com/roarkhq/sdk-roark-analytics-node/compare/v5.12.0...v5.13.0) (2026-10-24)
16
+
17
+
18
+ ### Features
19
+
20
+ * **lib:** code-first config authoring (defineAgent/defineTool/defineConfig) ([#1374](https://github.com/roarkhq/sdk-roark-analytics-node/issues/1374)) ([cd8c8ec](https://github.com/roarkhq/sdk-roark-analytics-node/commit/cd8c8ec55e33c795a0917dea47a0327d6df70904))
21
+
3
22
  ## [5.12.0](https://github.com/roarkhq/sdk-roark-analytics-node/compare/v5.11.0...v5.12.0) (2026-10-22)
4
23
 
5
24
 
@@ -0,0 +1,45 @@
1
+ import type { ConfigApplyParams } from "../resources/config.mjs";
2
+ export type Ref<T extends {
3
+ name: string;
4
+ }> = T | string;
5
+ export type AgentConfig = ConfigApplyParams.AgentConfig;
6
+ export type HTTPRequestDefinitionConfig = ConfigApplyParams.HTTPRequestDefinitionConfig;
7
+ export type PersonaConfig = ConfigApplyParams.PersonaConfig;
8
+ export type ImprovFlowConfig = ConfigApplyParams.ImprovFlowConfig;
9
+ export type ScriptedFlowConfig = ConfigApplyParams.ScriptedFlowConfig;
10
+ export type CollectorConfig = ConfigApplyParams.CollectorConfig;
11
+ export type MetricConfig = ConfigApplyParams.MetricConfig;
12
+ export type SimulationPlanConfig = ConfigApplyParams.SimulationPlanConfig;
13
+ export type QaSimulationPlanConfig = ConfigApplyParams.QaSimulationPlanConfig;
14
+ export type SimulationGroupConfig = ConfigApplyParams.SimulationGroupConfig;
15
+ export type AlertConfig = ConfigApplyParams.AlertConfig;
16
+ export type ToolConfig = ConfigApplyParams.ToolConfig;
17
+ export type DashboardConfig = ConfigApplyParams.DashboardConfig;
18
+ export type ProjectConfig = ConfigApplyParams.ProjectConfig;
19
+ /** Any resource a config bundle can carry. */
20
+ export type ResourceConfig = ConfigApplyParams['resources'][number];
21
+ export declare const defineAgent: (agent: Omit<AgentConfig, "kind">) => AgentConfig;
22
+ export declare const defineHTTPRequestDefinition: (def: Omit<HTTPRequestDefinitionConfig, "kind">) => HTTPRequestDefinitionConfig;
23
+ export declare const definePersona: (persona: Omit<PersonaConfig, "kind">) => PersonaConfig;
24
+ export declare const defineImprovFlow: (flow: Omit<ImprovFlowConfig, "kind" | "type">) => ImprovFlowConfig;
25
+ export declare const defineScriptedFlow: (flow: Omit<ScriptedFlowConfig, "kind" | "type">) => ScriptedFlowConfig;
26
+ export declare const defineCollector: (collector: Omit<CollectorConfig, "kind">) => CollectorConfig;
27
+ export declare const defineMetric: (metric: Omit<MetricConfig, "kind">) => MetricConfig;
28
+ export declare const defineSimulationPlan: (plan: Omit<SimulationPlanConfig, "kind">) => SimulationPlanConfig;
29
+ export declare const defineQaSimulationPlan: (plan: Omit<QaSimulationPlanConfig, "kind" | "template">) => QaSimulationPlanConfig;
30
+ export declare const defineSimulationGroup: (group: Omit<SimulationGroupConfig, "kind">) => SimulationGroupConfig;
31
+ export declare const defineAlert: (alert: Omit<AlertConfig, "kind">) => AlertConfig;
32
+ export declare const defineDashboard: (dashboard: Omit<DashboardConfig, "kind">) => DashboardConfig;
33
+ export declare const defineProject: (project: Omit<ProjectConfig, "kind">) => ProjectConfig;
34
+ /** Input to `defineTool`: `agent` accepts the agent construct or a name string. */
35
+ export type DefineToolInput = Omit<ToolConfig, 'kind' | 'agent'> & {
36
+ /** Scope the tool to one agent (omit for a project-wide tool). */
37
+ agent?: Ref<AgentConfig>;
38
+ };
39
+ export declare const defineTool: (tool: DefineToolInput) => ToolConfig;
40
+ export declare const defineConfig: (bundle: {
41
+ resources: Array<ResourceConfig>;
42
+ /** When true (the server default) config-managed resources absent from the bundle are deleted. */
43
+ prune?: boolean;
44
+ }) => ConfigApplyParams;
45
+ //# sourceMappingURL=config.d.mts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"config.d.mts","sourceRoot":"","sources":["../src/lib/config.ts"],"names":[],"mappings":"AAeA,OAAO,KAAK,EAAE,iBAAiB,EAAE,gCAA4B;AAK7D,MAAM,MAAM,GAAG,CAAC,CAAC,SAAS;IAAE,IAAI,EAAE,MAAM,CAAA;CAAE,IAAI,CAAC,GAAG,MAAM,CAAC;AAMzD,MAAM,MAAM,WAAW,GAAG,iBAAiB,CAAC,WAAW,CAAC;AACxD,MAAM,MAAM,2BAA2B,GAAG,iBAAiB,CAAC,2BAA2B,CAAC;AACxF,MAAM,MAAM,aAAa,GAAG,iBAAiB,CAAC,aAAa,CAAC;AAC5D,MAAM,MAAM,gBAAgB,GAAG,iBAAiB,CAAC,gBAAgB,CAAC;AAClE,MAAM,MAAM,kBAAkB,GAAG,iBAAiB,CAAC,kBAAkB,CAAC;AACtE,MAAM,MAAM,eAAe,GAAG,iBAAiB,CAAC,eAAe,CAAC;AAChE,MAAM,MAAM,YAAY,GAAG,iBAAiB,CAAC,YAAY,CAAC;AAC1D,MAAM,MAAM,oBAAoB,GAAG,iBAAiB,CAAC,oBAAoB,CAAC;AAC1E,MAAM,MAAM,sBAAsB,GAAG,iBAAiB,CAAC,sBAAsB,CAAC;AAC9E,MAAM,MAAM,qBAAqB,GAAG,iBAAiB,CAAC,qBAAqB,CAAC;AAC5E,MAAM,MAAM,WAAW,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,IAAI,CAAC,qBAAqB,EAAE,MAAM,CAAC,KAAG,qBAGjF,CAAC;AAEH,eAAO,MAAM,WAAW,GAAI,OAAO,IAAI,CAAC,WAAW,EAAE,MAAM,CAAC,KAAG,WAA4C,CAAC;AAE5G,eAAO,MAAM,eAAe,GAAI,WAAW,IAAI,CAAC,eAAe,EAAE,MAAM,CAAC,KAAG,eAGzE,CAAC;AAEH,eAAO,MAAM,aAAa,GAAI,SAAS,IAAI,CAAC,aAAa,EAAE,MAAM,CAAC,KAAG,aAGnE,CAAC;AAEH,mFAAmF;AACnF,MAAM,MAAM,eAAe,GAAG,IAAI,CAAC,UAAU,EAAE,MAAM,GAAG,OAAO,CAAC,GAAG;IACjE,kEAAkE;IAClE,KAAK,CAAC,EAAE,GAAG,CAAC,WAAW,CAAC,CAAC;CAC1B,CAAC;AAEF,eAAO,MAAM,UAAU,GAAI,MAAM,eAAe,KAAG,UAGlD,CAAC;AAOF,eAAO,MAAM,YAAY,GAAI,QAAQ;IACnC,SAAS,EAAE,KAAK,CAAC,cAAc,CAAC,CAAC;IACjC,kGAAkG;IAClG,KAAK,CAAC,EAAE,OAAO,CAAC;CACjB,KAAG,iBAGF,CAAC"}
@@ -0,0 +1,45 @@
1
+ import type { ConfigApplyParams } from "../resources/config.js";
2
+ export type Ref<T extends {
3
+ name: string;
4
+ }> = T | string;
5
+ export type AgentConfig = ConfigApplyParams.AgentConfig;
6
+ export type HTTPRequestDefinitionConfig = ConfigApplyParams.HTTPRequestDefinitionConfig;
7
+ export type PersonaConfig = ConfigApplyParams.PersonaConfig;
8
+ export type ImprovFlowConfig = ConfigApplyParams.ImprovFlowConfig;
9
+ export type ScriptedFlowConfig = ConfigApplyParams.ScriptedFlowConfig;
10
+ export type CollectorConfig = ConfigApplyParams.CollectorConfig;
11
+ export type MetricConfig = ConfigApplyParams.MetricConfig;
12
+ export type SimulationPlanConfig = ConfigApplyParams.SimulationPlanConfig;
13
+ export type QaSimulationPlanConfig = ConfigApplyParams.QaSimulationPlanConfig;
14
+ export type SimulationGroupConfig = ConfigApplyParams.SimulationGroupConfig;
15
+ export type AlertConfig = ConfigApplyParams.AlertConfig;
16
+ export type ToolConfig = ConfigApplyParams.ToolConfig;
17
+ export type DashboardConfig = ConfigApplyParams.DashboardConfig;
18
+ export type ProjectConfig = ConfigApplyParams.ProjectConfig;
19
+ /** Any resource a config bundle can carry. */
20
+ export type ResourceConfig = ConfigApplyParams['resources'][number];
21
+ export declare const defineAgent: (agent: Omit<AgentConfig, "kind">) => AgentConfig;
22
+ export declare const defineHTTPRequestDefinition: (def: Omit<HTTPRequestDefinitionConfig, "kind">) => HTTPRequestDefinitionConfig;
23
+ export declare const definePersona: (persona: Omit<PersonaConfig, "kind">) => PersonaConfig;
24
+ export declare const defineImprovFlow: (flow: Omit<ImprovFlowConfig, "kind" | "type">) => ImprovFlowConfig;
25
+ export declare const defineScriptedFlow: (flow: Omit<ScriptedFlowConfig, "kind" | "type">) => ScriptedFlowConfig;
26
+ export declare const defineCollector: (collector: Omit<CollectorConfig, "kind">) => CollectorConfig;
27
+ export declare const defineMetric: (metric: Omit<MetricConfig, "kind">) => MetricConfig;
28
+ export declare const defineSimulationPlan: (plan: Omit<SimulationPlanConfig, "kind">) => SimulationPlanConfig;
29
+ export declare const defineQaSimulationPlan: (plan: Omit<QaSimulationPlanConfig, "kind" | "template">) => QaSimulationPlanConfig;
30
+ export declare const defineSimulationGroup: (group: Omit<SimulationGroupConfig, "kind">) => SimulationGroupConfig;
31
+ export declare const defineAlert: (alert: Omit<AlertConfig, "kind">) => AlertConfig;
32
+ export declare const defineDashboard: (dashboard: Omit<DashboardConfig, "kind">) => DashboardConfig;
33
+ export declare const defineProject: (project: Omit<ProjectConfig, "kind">) => ProjectConfig;
34
+ /** Input to `defineTool`: `agent` accepts the agent construct or a name string. */
35
+ export type DefineToolInput = Omit<ToolConfig, 'kind' | 'agent'> & {
36
+ /** Scope the tool to one agent (omit for a project-wide tool). */
37
+ agent?: Ref<AgentConfig>;
38
+ };
39
+ export declare const defineTool: (tool: DefineToolInput) => ToolConfig;
40
+ export declare const defineConfig: (bundle: {
41
+ resources: Array<ResourceConfig>;
42
+ /** When true (the server default) config-managed resources absent from the bundle are deleted. */
43
+ prune?: boolean;
44
+ }) => ConfigApplyParams;
45
+ //# sourceMappingURL=config.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"config.d.ts","sourceRoot":"","sources":["../src/lib/config.ts"],"names":[],"mappings":"AAeA,OAAO,KAAK,EAAE,iBAAiB,EAAE,+BAA4B;AAK7D,MAAM,MAAM,GAAG,CAAC,CAAC,SAAS;IAAE,IAAI,EAAE,MAAM,CAAA;CAAE,IAAI,CAAC,GAAG,MAAM,CAAC;AAMzD,MAAM,MAAM,WAAW,GAAG,iBAAiB,CAAC,WAAW,CAAC;AACxD,MAAM,MAAM,2BAA2B,GAAG,iBAAiB,CAAC,2BAA2B,CAAC;AACxF,MAAM,MAAM,aAAa,GAAG,iBAAiB,CAAC,aAAa,CAAC;AAC5D,MAAM,MAAM,gBAAgB,GAAG,iBAAiB,CAAC,gBAAgB,CAAC;AAClE,MAAM,MAAM,kBAAkB,GAAG,iBAAiB,CAAC,kBAAkB,CAAC;AACtE,MAAM,MAAM,eAAe,GAAG,iBAAiB,CAAC,eAAe,CAAC;AAChE,MAAM,MAAM,YAAY,GAAG,iBAAiB,CAAC,YAAY,CAAC;AAC1D,MAAM,MAAM,oBAAoB,GAAG,iBAAiB,CAAC,oBAAoB,CAAC;AAC1E,MAAM,MAAM,sBAAsB,GAAG,iBAAiB,CAAC,sBAAsB,CAAC;AAC9E,MAAM,MAAM,qBAAqB,GAAG,iBAAiB,CAAC,qBAAqB,CAAC;AAC5E,MAAM,MAAM,WAAW,GAAG,iBAAiB,CAAC,WAAW,CAAC;AACxD,MAAM,MAAM,UAAU,GAAG,iBAAiB,CAAC,UAAU,CAAC;AACtD,MAAM,MAAM,eAAe,GAAG,iBAAiB,CAAC,eAAe,CAAC;AAChE,MAAM,M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eAAO,MAAM,eAAe,GAAI,WAAW,IAAI,CAAC,eAAe,EAAE,MAAM,CAAC,KAAG,eAGzE,CAAC;AAEH,eAAO,MAAM,aAAa,GAAI,SAAS,IAAI,CAAC,aAAa,EAAE,MAAM,CAAC,KAAG,aAGnE,CAAC;AAEH,mFAAmF;AACnF,MAAM,MAAM,eAAe,GAAG,IAAI,CAAC,UAAU,EAAE,MAAM,GAAG,OAAO,CAAC,GAAG;IACjE,kEAAkE;IAClE,KAAK,CAAC,EAAE,GAAG,CAAC,WAAW,CAAC,CAAC;CAC1B,CAAC;AAEF,eAAO,MAAM,UAAU,GAAI,MAAM,eAAe,KAAG,UAGlD,CAAC;AAOF,eAAO,MAAM,YAAY,GAAI,QAAQ;IACnC,SAAS,EAAE,KAAK,CAAC,cAAc,CAAC,CAAC;IACjC,kGAAkG;IAClG,KAAK,CAAC,EAAE,OAAO,CAAC;CACjB,KAAG,iBAGF,CAAC"}
package/lib/config.js ADDED
@@ -0,0 +1,91 @@
1
+ "use strict";
2
+ // Code-first config authoring: a typed, ergonomic alternative to hand-written
3
+ // config YAML. Build agents, tools, personas, flows, metrics and the rest in
4
+ // TypeScript, then ship them with `client.config.apply(...)` (or preview with
5
+ // `client.config.diff(...)`).
6
+ //
7
+ // Each `define*` helper injects the resource's `kind` (and any fixed
8
+ // discriminator) and returns the exact param object the config endpoints expect,
9
+ // so the output is identical to the YAML path: both produce a config bundle.
10
+ // Input types are DERIVED from the generated `ConfigApplyParams`, so a new field
11
+ // on a resource (for example a tool `handler`) shows up here automatically on the
12
+ // next codegen, with no change to this file.
13
+ //
14
+ // This lives in `src/lib`, which Stainless codegen never touches. Import it from
15
+ // `@roarkanalytics/sdk/lib/config`.
16
+ Object.defineProperty(exports, "__esModule", { value: true });
17
+ exports.defineConfig = exports.defineTool = exports.defineProject = exports.defineDashboard = exports.defineAlert = exports.defineSimulationGroup = exports.defineQaSimulationPlan = exports.defineSimulationPlan = exports.defineMetric = exports.defineCollector = exports.defineScriptedFlow = exports.defineImprovFlow = exports.definePersona = exports.defineHTTPRequestDefinition = exports.defineAgent = void 0;
18
+ const refName = (ref) => typeof ref === 'string' ? ref : ref.name;
19
+ // ── Builders ──
20
+ // Prompts are just strings here: pass an inline template literal or
21
+ // `readFileSync('./prompt.md', 'utf8')`. No `file://` sentinel needed.
22
+ const defineAgent = (agent) => ({ kind: 'agent', ...agent });
23
+ exports.defineAgent = defineAgent;
24
+ const defineHTTPRequestDefinition = (def) => ({ kind: 'httpRequestDefinition', ...def });
25
+ exports.defineHTTPRequestDefinition = defineHTTPRequestDefinition;
26
+ const definePersona = (persona) => ({
27
+ kind: 'persona',
28
+ ...persona,
29
+ });
30
+ exports.definePersona = definePersona;
31
+ const defineImprovFlow = (flow) => ({
32
+ kind: 'flow',
33
+ type: 'improv',
34
+ ...flow,
35
+ });
36
+ exports.defineImprovFlow = defineImprovFlow;
37
+ const defineScriptedFlow = (flow) => ({
38
+ kind: 'flow',
39
+ type: 'scripted',
40
+ ...flow,
41
+ });
42
+ exports.defineScriptedFlow = defineScriptedFlow;
43
+ const defineCollector = (collector) => ({
44
+ kind: 'collector',
45
+ ...collector,
46
+ });
47
+ exports.defineCollector = defineCollector;
48
+ const defineMetric = (metric) => ({
49
+ kind: 'metric',
50
+ ...metric,
51
+ });
52
+ exports.defineMetric = defineMetric;
53
+ const defineSimulationPlan = (plan) => ({
54
+ kind: 'simulationPlan',
55
+ ...plan,
56
+ });
57
+ exports.defineSimulationPlan = defineSimulationPlan;
58
+ const defineQaSimulationPlan = (plan) => ({ kind: 'simulationPlan', template: 'question-answer-check', ...plan });
59
+ exports.defineQaSimulationPlan = defineQaSimulationPlan;
60
+ const defineSimulationGroup = (group) => ({
61
+ kind: 'simulationGroup',
62
+ ...group,
63
+ });
64
+ exports.defineSimulationGroup = defineSimulationGroup;
65
+ const defineAlert = (alert) => ({ kind: 'alert', ...alert });
66
+ exports.defineAlert = defineAlert;
67
+ const defineDashboard = (dashboard) => ({
68
+ kind: 'dashboard',
69
+ ...dashboard,
70
+ });
71
+ exports.defineDashboard = defineDashboard;
72
+ const defineProject = (project) => ({
73
+ kind: 'project',
74
+ ...project,
75
+ });
76
+ exports.defineProject = defineProject;
77
+ const defineTool = (tool) => {
78
+ const { agent, ...rest } = tool;
79
+ return { kind: 'tool', ...rest, ...(agent === undefined ? {} : { agent: refName(agent) }) };
80
+ };
81
+ exports.defineTool = defineTool;
82
+ // ── The bundle ──
83
+ // `defineConfig` assembles the bundle you hand to `client.config.apply(bundle)`
84
+ // or `client.config.diff(bundle)`. `resources` accepts both construct outputs
85
+ // and raw resource objects, so a kind without a dedicated builder still fits.
86
+ const defineConfig = (bundle) => ({
87
+ resources: bundle.resources,
88
+ ...(bundle.prune === undefined ? {} : { prune: bundle.prune }),
89
+ });
90
+ exports.defineConfig = defineConfig;
91
+ //# sourceMappingURL=config.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"config.js","sourceRoot":"","sources":["../src/lib/config.ts"],"names":[],"mappings":";AAAA,8EAA8E;AAC9E,6EAA6E;AAC7E,8EAA8E;AAC9E,8BAA8B;AAC9B,EAAE;AACF,qEAAqE;AACrE,iFAAiF;AACjF,6EAA6E;AAC7E,iFAAiF;AACjF,kFAAkF;AAClF,6CAA6C;AAC7C,EAAE;AACF,iFAAiF;AACjF,oCAAoC;;;AASpC,MAAM,OAAO,GAAG,CAA6B,GAAW,EAAU,EAAE,CAClE,OAAO,GAAG,KAAK,QAAQ,CAAC,CAAC,CAAC,GAAG,CAAC,CAAC,CAAC,GAAG,CAAC,IAAI,CAAC;AAqB3C,iBAAiB;AACjB,oEAAoE;AACpE,uEAAuE;AAEhE,MAAM,WAAW,GAAG,CAAC,KAAgC,EAAe,EAAE,CAAC,CAAC,EAAE,IAAI,EAAE,OAAO,EAAE,GAAG,KAAK,EAAE,CAAC,CAAC;AAA/F,QAAA,WAAW,eAAoF;AAErG,MAAM,2BAA2B,GAAG,CACzC,GAA8C,EACjB,EAAE,CAAC,CAAC,EAAE,I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AC,KAAK,EAAE,CAAC;CAC/D,CAAC,CAAC;AAPU,QAAA,YAAY,gBAOtB"}
package/lib/config.mjs ADDED
@@ -0,0 +1,73 @@
1
+ // Code-first config authoring: a typed, ergonomic alternative to hand-written
2
+ // config YAML. Build agents, tools, personas, flows, metrics and the rest in
3
+ // TypeScript, then ship them with `client.config.apply(...)` (or preview with
4
+ // `client.config.diff(...)`).
5
+ //
6
+ // Each `define*` helper injects the resource's `kind` (and any fixed
7
+ // discriminator) and returns the exact param object the config endpoints expect,
8
+ // so the output is identical to the YAML path: both produce a config bundle.
9
+ // Input types are DERIVED from the generated `ConfigApplyParams`, so a new field
10
+ // on a resource (for example a tool `handler`) shows up here automatically on the
11
+ // next codegen, with no change to this file.
12
+ //
13
+ // This lives in `src/lib`, which Stainless codegen never touches. Import it from
14
+ // `@roarkanalytics/sdk/lib/config`.
15
+ const refName = (ref) => typeof ref === 'string' ? ref : ref.name;
16
+ // ── Builders ──
17
+ // Prompts are just strings here: pass an inline template literal or
18
+ // `readFileSync('./prompt.md', 'utf8')`. No `file://` sentinel needed.
19
+ export const defineAgent = (agent) => ({ kind: 'agent', ...agent });
20
+ export const defineHTTPRequestDefinition = (def) => ({ kind: 'httpRequestDefinition', ...def });
21
+ export const definePersona = (persona) => ({
22
+ kind: 'persona',
23
+ ...persona,
24
+ });
25
+ export const defineImprovFlow = (flow) => ({
26
+ kind: 'flow',
27
+ type: 'improv',
28
+ ...flow,
29
+ });
30
+ export const defineScriptedFlow = (flow) => ({
31
+ kind: 'flow',
32
+ type: 'scripted',
33
+ ...flow,
34
+ });
35
+ export const defineCollector = (collector) => ({
36
+ kind: 'collector',
37
+ ...collector,
38
+ });
39
+ export const defineMetric = (metric) => ({
40
+ kind: 'metric',
41
+ ...metric,
42
+ });
43
+ export const defineSimulationPlan = (plan) => ({
44
+ kind: 'simulationPlan',
45
+ ...plan,
46
+ });
47
+ export const defineQaSimulationPlan = (plan) => ({ kind: 'simulationPlan', template: 'question-answer-check', ...plan });
48
+ export const defineSimulationGroup = (group) => ({
49
+ kind: 'simulationGroup',
50
+ ...group,
51
+ });
52
+ export const defineAlert = (alert) => ({ kind: 'alert', ...alert });
53
+ export const defineDashboard = (dashboard) => ({
54
+ kind: 'dashboard',
55
+ ...dashboard,
56
+ });
57
+ export const defineProject = (project) => ({
58
+ kind: 'project',
59
+ ...project,
60
+ });
61
+ export const defineTool = (tool) => {
62
+ const { agent, ...rest } = tool;
63
+ return { kind: 'tool', ...rest, ...(agent === undefined ? {} : { agent: refName(agent) }) };
64
+ };
65
+ // ── The bundle ──
66
+ // `defineConfig` assembles the bundle you hand to `client.config.apply(bundle)`
67
+ // or `client.config.diff(bundle)`. `resources` accepts both construct outputs
68
+ // and raw resource objects, so a kind without a dedicated builder still fits.
69
+ export const defineConfig = (bundle) => ({
70
+ resources: bundle.resources,
71
+ ...(bundle.prune === undefined ? {} : { prune: bundle.prune }),
72
+ });
73
+ //# sourceMappingURL=config.mjs.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"config.mjs","sourceRoot":"","sources":["../src/lib/config.ts"],"names":[],"mappings":"AAAA,8EAA8E;AAC9E,6EAA6E;AAC7E,8EAA8E;AAC9E,8BAA8B;AAC9B,EAAE;AACF,qEAAqE;AACrE,iFAAiF;AACjF,6EAA6E;AAC7E,iFAAiF;AACjF,kFAAkF;AAClF,6CAA6C;AAC7C,EAAE;AACF,iFAAiF;AACjF,oCAAoC;AASpC,MAAM,OAAO,GAAG,CAA6B,GAAW,EAAU,EAAE,CAClE,OAAO,GAAG,KAAK,QAAQ,CAAC,CAAC,CAAC,GAAG,CAAC,CAAC,CAAC,GAAG,CAAC,IAAI,CAAC;AAqB3C,iBAAiB;AACjB,oEAAoE;AACpE,uEAAuE;AAEvE,MAAM,CAAC,MAAM,WAAW,GAAG,CAAC,KAAgC,EAAe,EAAE,CAAC,CAAC,EAAE,IAAI,EAAE,OAAO,EAAE,GAAG,KAAK,EAAE,CAAC,CAAC;AAE5G,MAAM,CAAC,M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5.14.0",
4
4
  "description": "The official TypeScript library for the Roark API",
5
5
  "author": "Roark <james@roark.ai>",
6
6
  "types": "./index.d.ts",
@@ -81,6 +81,16 @@
81
81
  "./index.mjs": {
82
82
  "default": "./index.mjs"
83
83
  },
84
+ "./lib/*.mjs": {
85
+ "default": "./lib/*.mjs"
86
+ },
87
+ "./lib/*.js": {
88
+ "default": "./lib/*.js"
89
+ },
90
+ "./lib/*": {
91
+ "import": "./lib/*.mjs",
92
+ "require": "./lib/*.js"
93
+ },
84
94
  "./resource": {
85
95
  "import": "./resource.mjs",
86
96
  "require": "./resource.js"
@@ -498,11 +498,19 @@ export declare namespace Bundle {
498
498
  agent?: string;
499
499
  description?: string | null;
500
500
  expectedResult?: string | null;
501
+ handler?: ToolConfig.Handler;
501
502
  invocationCriteria?: string | null;
502
503
  parameters?: {
503
504
  [key: string]: 'string' | 'number' | 'boolean';
504
505
  };
505
506
  }
507
+ namespace ToolConfig {
508
+ interface Handler {
509
+ type: 'http';
510
+ url: string;
511
+ method?: 'GET' | 'POST' | 'PUT' | 'PATCH' | 'DELETE';
512
+ }
513
+ }
506
514
  interface DashboardConfig {
507
515
  kind: 'dashboard';
508
516
  name: string;
@@ -1073,11 +1081,19 @@ export declare namespace Bundle {
1073
1081
  agent?: string;
1074
1082
  description?: string | null;
1075
1083
  expectedResult?: string | null;
1084
+ handler?: ToolConfig.Handler;
1076
1085
  invocationCriteria?: string | null;
1077
1086
  parameters?: {
1078
1087
  [key: string]: 'string' | 'number' | 'boolean';
1079
1088
  };
1080
1089
  }
1090
+ namespace ToolConfig {
1091
+ interface Handler {
1092
+ type: 'http';
1093
+ url: string;
1094
+ method?: 'GET' | 'POST' | 'PUT' | 'PATCH' | 'DELETE';
1095
+ }
1096
+ }
1081
1097
  interface DashboardConfig {
1082
1098
  kind: 'dashboard';
1083
1099
  name: string;
@@ -1726,11 +1742,19 @@ export declare namespace ConfigApplyParams {
1726
1742
  agent?: string;
1727
1743
  description?: string | null;
1728
1744
  expectedResult?: string | null;
1745
+ handler?: ToolConfig.Handler;
1729
1746
  invocationCriteria?: string | null;
1730
1747
  parameters?: {
1731
1748
  [key: string]: 'string' | 'number' | 'boolean';
1732
1749
  };
1733
1750
  }
1751
+ namespace ToolConfig {
1752
+ interface Handler {
1753
+ type: 'http';
1754
+ url: string;
1755
+ method?: 'GET' | 'POST' | 'PUT' | 'PATCH' | 'DELETE';
1756
+ }
1757
+ }
1734
1758
  interface DashboardConfig {
1735
1759
  kind: 'dashboard';
1736
1760
  name: string;
@@ -2301,11 +2325,19 @@ export declare namespace ConfigApplyParams {
2301
2325
  agent?: string;
2302
2326
  description?: string | null;
2303
2327
  expectedResult?: string | null;
2328
+ handler?: ToolConfig.Handler;
2304
2329
  invocationCriteria?: string | null;
2305
2330
  parameters?: {
2306
2331
  [key: string]: 'string' | 'number' | 'boolean';
2307
2332
  };
2308
2333
  }
2334
+ namespace ToolConfig {
2335
+ interface Handler {
2336
+ type: 'http';
2337
+ url: string;
2338
+ method?: 'GET' | 'POST' | 'PUT' | 'PATCH' | 'DELETE';
2339
+ }
2340
+ }
2309
2341
  interface DashboardConfig {
2310
2342
  kind: 'dashboard';
2311
2343
  name: string;
@@ -2868,11 +2900,19 @@ export declare namespace ConfigDiffParams {
2868
2900
  agent?: string;
2869
2901
  description?: string | null;
2870
2902
  expectedResult?: string | null;
2903
+ handler?: ToolConfig.Handler;
2871
2904
  invocationCriteria?: string | null;
2872
2905
  parameters?: {
2873
2906
  [key: string]: 'string' | 'number' | 'boolean';
2874
2907
  };
2875
2908
  }
2909
+ namespace ToolConfig {
2910
+ interface Handler {
2911
+ type: 'http';
2912
+ url: string;
2913
+ method?: 'GET' | 'POST' | 'PUT' | 'PATCH' | 'DELETE';
2914
+ }
2915
+ }
2876
2916
  interface DashboardConfig {
2877
2917
  kind: 'dashboard';
2878
2918
  name: string;
@@ -3443,11 +3483,19 @@ export declare namespace ConfigDiffParams {
3443
3483
  agent?: string;
3444
3484
  description?: string | null;
3445
3485
  expectedResult?: string | null;
3486
+ handler?: ToolConfig.Handler;
3446
3487
  invocationCriteria?: string | null;
3447
3488
  parameters?: {
3448
3489
  [key: string]: 'string' | 'number' | 'boolean';
3449
3490
  };
3450
3491
  }
3492
+ namespace ToolConfig {
3493
+ interface Handler {
3494
+ type: 'http';
3495
+ url: string;
3496
+ method?: 'GET' | 'POST' | 'PUT' | 'PATCH' | 'DELETE';
3497
+ }
3498
+ }
3451
3499
  interface DashboardConfig {
3452
3500
  kind: 'dashboard';
3453
3501
  name: string;