@boboddy/sdk 0.1.45-alpha → 0.2.1-alpha
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/dist/client.js +37 -0
- package/dist/defaults/index.js +3 -3
- package/dist/definitions/pipelines/builder-helpers.d.ts +69 -0
- package/dist/definitions/pipelines/builder.d.ts +4 -57
- package/dist/definitions/pipelines/index.js +111 -84
- package/dist/definitions/steps/index.js +62 -27
- package/dist/definitions/steps/step-features.d.ts +3 -3
- package/dist/generated/index.d.ts +2 -2
- package/dist/generated/sdk.gen.d.ts +9 -1
- package/dist/generated/types.gen.d.ts +473 -4
- package/dist/index.js +156 -109
- package/dist/opencode-mcp.js +2 -2
- package/dist/opencode-plugin.js +2 -2
- package/dist/push/index.js +152 -111
- package/dist/step-execution-plane-client.d.ts +11 -0
- package/package.json +1 -1
package/dist/client.js
CHANGED
|
@@ -1009,6 +1009,22 @@ class StepExecutions extends HeyApiClient {
|
|
|
1009
1009
|
getStepExecution(options) {
|
|
1010
1010
|
return (options.client ?? this.client).get({ url: "/api/step-executions/{stepExecutionId}", ...options });
|
|
1011
1011
|
}
|
|
1012
|
+
readStepExecutionLogs(options) {
|
|
1013
|
+
return (options.client ?? this.client).get({ url: "/api/step-executions/{stepExecutionId}/logs", ...options });
|
|
1014
|
+
}
|
|
1015
|
+
appendStepExecutionLogs(options) {
|
|
1016
|
+
return (options.client ?? this.client).post({
|
|
1017
|
+
url: "/api/step-executions/{stepExecutionId}/logs",
|
|
1018
|
+
...options,
|
|
1019
|
+
headers: {
|
|
1020
|
+
"Content-Type": "application/json",
|
|
1021
|
+
...options.headers
|
|
1022
|
+
}
|
|
1023
|
+
});
|
|
1024
|
+
}
|
|
1025
|
+
getStepExecutionLogArchive(options) {
|
|
1026
|
+
return (options.client ?? this.client).get({ url: "/api/step-executions/{stepExecutionId}/logs/archive", ...options });
|
|
1027
|
+
}
|
|
1012
1028
|
}
|
|
1013
1029
|
|
|
1014
1030
|
class PipelineDefinitions extends HeyApiClient {
|
|
@@ -1347,6 +1363,12 @@ class ProjectInvites extends HeyApiClient {
|
|
|
1347
1363
|
}
|
|
1348
1364
|
}
|
|
1349
1365
|
|
|
1366
|
+
class Billing extends HeyApiClient {
|
|
1367
|
+
getOrgUsage(options) {
|
|
1368
|
+
return (options.client ?? this.client).get({ url: "/api/orgs/{orgId}/usage", ...options });
|
|
1369
|
+
}
|
|
1370
|
+
}
|
|
1371
|
+
|
|
1350
1372
|
class BoboddyClient extends HeyApiClient {
|
|
1351
1373
|
static __registry = new HeyApiRegistry;
|
|
1352
1374
|
constructor(args) {
|
|
@@ -1409,6 +1431,10 @@ class BoboddyClient extends HeyApiClient {
|
|
|
1409
1431
|
get projectInvites() {
|
|
1410
1432
|
return this._projectInvites ??= new ProjectInvites({ client: this.client });
|
|
1411
1433
|
}
|
|
1434
|
+
_billing;
|
|
1435
|
+
get billing() {
|
|
1436
|
+
return this._billing ??= new Billing({ client: this.client });
|
|
1437
|
+
}
|
|
1412
1438
|
}
|
|
1413
1439
|
// src/step-execution-plane-client.ts
|
|
1414
1440
|
function createStepExecutionPlaneClient(baseUrl) {
|
|
@@ -1471,6 +1497,16 @@ var buildStepExecutionPlaneClient = (stepExecutions) => {
|
|
|
1471
1497
|
});
|
|
1472
1498
|
if (result.error)
|
|
1473
1499
|
throw new Error(JSON.stringify(result.error));
|
|
1500
|
+
},
|
|
1501
|
+
appendStepExecutionLogs: async (stepExecutionId, body, options) => {
|
|
1502
|
+
const result = await stepExecutions.appendStepExecutionLogs({
|
|
1503
|
+
path: { stepExecutionId },
|
|
1504
|
+
body,
|
|
1505
|
+
headers: options?.headers
|
|
1506
|
+
});
|
|
1507
|
+
if (result.error)
|
|
1508
|
+
throw new Error(JSON.stringify(result.error));
|
|
1509
|
+
return result.data;
|
|
1474
1510
|
}
|
|
1475
1511
|
};
|
|
1476
1512
|
};
|
|
@@ -1497,5 +1533,6 @@ export {
|
|
|
1497
1533
|
NotificationRules,
|
|
1498
1534
|
GitHubIntegrations,
|
|
1499
1535
|
BoboddyClient,
|
|
1536
|
+
Billing,
|
|
1500
1537
|
Api
|
|
1501
1538
|
};
|
package/dist/defaults/index.js
CHANGED
|
@@ -281,7 +281,7 @@ async function loadProjectConfig(rootDir = process.cwd()) {
|
|
|
281
281
|
import path2 from "path";
|
|
282
282
|
async function findProjectConfigUpwards(startDir) {
|
|
283
283
|
let current = path2.resolve(startDir);
|
|
284
|
-
|
|
284
|
+
for (;; ) {
|
|
285
285
|
const found = await loadProjectConfig(current);
|
|
286
286
|
if (found)
|
|
287
287
|
return found;
|
|
@@ -294,9 +294,9 @@ async function findProjectConfigUpwards(startDir) {
|
|
|
294
294
|
async function loadPushDefaults(opts) {
|
|
295
295
|
const baseUrl = resolveBoboddyBaseUrl();
|
|
296
296
|
const envProjectId = process.env["BOBODDY_PROJECT_ID"]?.trim();
|
|
297
|
-
const projectId = envProjectId
|
|
297
|
+
const projectId = envProjectId ? envProjectId : (await findProjectConfigUpwards(opts.dir))?.projectId;
|
|
298
298
|
const envAccessToken = process.env["BOBODDY_ACCESS_TOKEN"]?.trim();
|
|
299
|
-
const accessToken = envAccessToken
|
|
299
|
+
const accessToken = envAccessToken ? envAccessToken : loadAuthProfile(baseUrl)?.accessToken;
|
|
300
300
|
return { baseUrl, projectId, accessToken };
|
|
301
301
|
}
|
|
302
302
|
export {
|
|
@@ -0,0 +1,69 @@
|
|
|
1
|
+
import { z, type ZodType } from "zod";
|
|
2
|
+
import { type AdditionalStepInputBinding, type TypedStepDefinitionSpec } from "../steps/define-step";
|
|
3
|
+
import { type AnyBinding, type LiteralBinding, type StepOutputBinding, type StepSignalBinding, type WorkItemBinding } from "./define-pipeline";
|
|
4
|
+
import { type InputAccessor } from "./input-accessor";
|
|
5
|
+
export type AnyTypedStep = TypedStepDefinitionSpec<any, any, any, any>;
|
|
6
|
+
export type StepConfig = {
|
|
7
|
+
timeout?: number | null;
|
|
8
|
+
};
|
|
9
|
+
type ElementOf<T extends ReadonlyArray<unknown>> = T extends ReadonlyArray<infer U> ? U : never;
|
|
10
|
+
export type WorkItemAccessor = {
|
|
11
|
+
readonly title: WorkItemBinding;
|
|
12
|
+
readonly description: WorkItemBinding;
|
|
13
|
+
readonly field: (fieldName: string) => WorkItemBinding;
|
|
14
|
+
};
|
|
15
|
+
export type WithWorkItemFields<T> = {
|
|
16
|
+
workItemTitle: string;
|
|
17
|
+
workItemDescription: string | null;
|
|
18
|
+
} & T;
|
|
19
|
+
type RequiredInputKeys<T extends object> = {
|
|
20
|
+
[K in keyof T & string]-?: undefined extends T[K] ? never : K;
|
|
21
|
+
}[keyof T & string];
|
|
22
|
+
type OptionalInputKeys<T extends object> = {
|
|
23
|
+
[K in keyof T & string]-?: undefined extends T[K] ? K : never;
|
|
24
|
+
}[keyof T & string];
|
|
25
|
+
type Prettify<T> = {
|
|
26
|
+
[K in keyof T]: T[K];
|
|
27
|
+
} & {};
|
|
28
|
+
export type StepInputCtx<TInput extends ZodType, TSteps extends ReadonlyArray<AnyTypedStep>> = {
|
|
29
|
+
input: InputAccessor<Prettify<WithWorkItemFields<TInput["_output"]>>>;
|
|
30
|
+
signal: <S extends ElementOf<TSteps>>(step: S, key: S["__signalKeys"]) => StepSignalBinding;
|
|
31
|
+
output: (step: ElementOf<TSteps>) => StepOutputBinding;
|
|
32
|
+
literal: (value: unknown) => LiteralBinding;
|
|
33
|
+
};
|
|
34
|
+
type ReservedPipelineInputKeys = "workItemTitle" | "workItemDescription";
|
|
35
|
+
export type NoReservedKeys<T extends ZodType> = T extends {
|
|
36
|
+
shape: infer Shape;
|
|
37
|
+
} ? [keyof Shape & ReservedPipelineInputKeys] extends [never] ? T : never : T;
|
|
38
|
+
export type PipelineMeta<TInput extends ZodType = z.ZodUnknown> = {
|
|
39
|
+
key: string;
|
|
40
|
+
name: string;
|
|
41
|
+
description?: string;
|
|
42
|
+
version?: number;
|
|
43
|
+
status?: "draft" | "active";
|
|
44
|
+
additionalPipelineInput?: {
|
|
45
|
+
schema: NoReservedKeys<TInput>;
|
|
46
|
+
bindings: (ctx: {
|
|
47
|
+
workItem: WorkItemAccessor;
|
|
48
|
+
literal: (value: unknown) => LiteralBinding;
|
|
49
|
+
}) => TInput["_output"] extends object ? {
|
|
50
|
+
[K in RequiredInputKeys<TInput["_output"]>]: AnyBinding;
|
|
51
|
+
} & {
|
|
52
|
+
[K in OptionalInputKeys<TInput["_output"]>]?: AnyBinding;
|
|
53
|
+
} : Partial<Record<string, AnyBinding>>;
|
|
54
|
+
};
|
|
55
|
+
additionalStepInput?: {
|
|
56
|
+
schema: ZodType;
|
|
57
|
+
bindings: (ctx: {
|
|
58
|
+
workItemField: (fieldName: string) => WorkItemBinding;
|
|
59
|
+
literal: (value: unknown) => LiteralBinding;
|
|
60
|
+
}) => Partial<Record<string, AdditionalStepInputBinding>>;
|
|
61
|
+
};
|
|
62
|
+
};
|
|
63
|
+
export declare const WORK_ITEM_ACCESSOR: WorkItemAccessor;
|
|
64
|
+
export declare function makeStepInputCtx<TInput extends ZodType>(inputSchema: TInput): StepInputCtx<TInput, ReadonlyArray<AnyTypedStep>>;
|
|
65
|
+
export declare function literal(value: unknown): LiteralBinding;
|
|
66
|
+
export declare function normalizeInputMapping(mapping: Record<string, AnyBinding | undefined> | undefined): Record<string, AnyBinding> | undefined;
|
|
67
|
+
export declare function resolveAdditionalStepInputBindings(label: "additionalStepInput", definition: PipelineMeta["additionalStepInput"] | undefined): Record<string, AnyBinding>;
|
|
68
|
+
export declare function mergeStepBindings(pipelineBindings: Record<string, AnyBinding>, explicitBindings: Record<string, AnyBinding> | undefined): Record<string, AnyBinding> | undefined;
|
|
69
|
+
export {};
|
|
@@ -1,13 +1,8 @@
|
|
|
1
1
|
import { z, type ZodType } from "zod";
|
|
2
|
-
import { type AdditionalStepInputBinding, type TypedStepDefinitionSpec } from "../steps/define-step";
|
|
3
2
|
import { type AdvanceCtx, type AdvanceResult } from "../advancement-policies/fluent-rules";
|
|
4
|
-
import { type AnyBinding, type
|
|
5
|
-
import { type
|
|
6
|
-
type AnyTypedStep
|
|
7
|
-
export type StepConfig = {
|
|
8
|
-
timeout?: number | null;
|
|
9
|
-
};
|
|
10
|
-
type ElementOf<T extends ReadonlyArray<unknown>> = T extends ReadonlyArray<infer U> ? U : never;
|
|
3
|
+
import { type AnyBinding, type PipelineDefinitionSpec, type PipelineStepConfig } from "./define-pipeline";
|
|
4
|
+
import { type AnyTypedStep, type PipelineMeta, type StepConfig, type StepInputCtx } from "./builder-helpers";
|
|
5
|
+
export type { AnyTypedStep, PipelineMeta, StepConfig, StepInputCtx, WorkItemAccessor, } from "./builder-helpers";
|
|
11
6
|
type LastStep<T extends ReadonlyArray<AnyTypedStep>> = T extends readonly [
|
|
12
7
|
...AnyTypedStep[],
|
|
13
8
|
infer L
|
|
@@ -15,9 +10,6 @@ type LastStep<T extends ReadonlyArray<AnyTypedStep>> = T extends readonly [
|
|
|
15
10
|
type LastSignalKeys<T extends ReadonlyArray<AnyTypedStep>> = LastStep<T> extends AnyTypedStep ? LastStep<T>["__signalKeys"] : never;
|
|
16
11
|
type LastSignalTypeMap<T extends ReadonlyArray<AnyTypedStep>> = LastStep<T> extends AnyTypedStep ? LastStep<T>["__signalTypeMap"] : Record<string, unknown>;
|
|
17
12
|
type IsAny<T> = 0 extends 1 & T ? true : false;
|
|
18
|
-
type Prettify<T> = {
|
|
19
|
-
[K in keyof T]: T[K];
|
|
20
|
-
} & {};
|
|
21
13
|
type RequiredInputKeys<T extends object> = {
|
|
22
14
|
[K in keyof T & string]-?: undefined extends T[K] ? never : K;
|
|
23
15
|
}[keyof T & string];
|
|
@@ -29,50 +21,6 @@ type StepInputMapping<S extends AnyTypedStep> = IsAny<S["__inputType"]> extends
|
|
|
29
21
|
} & {
|
|
30
22
|
[K in OptionalInputKeys<S["__inputType"]>]?: AnyBinding;
|
|
31
23
|
} : Partial<Record<string, AnyBinding>>;
|
|
32
|
-
export type WorkItemAccessor = {
|
|
33
|
-
readonly title: WorkItemBinding;
|
|
34
|
-
readonly description: WorkItemBinding;
|
|
35
|
-
readonly field: (fieldName: string) => WorkItemBinding;
|
|
36
|
-
};
|
|
37
|
-
type WithWorkItemFields<T> = {
|
|
38
|
-
workItemTitle: string;
|
|
39
|
-
workItemDescription: string | null;
|
|
40
|
-
} & T;
|
|
41
|
-
export type StepInputCtx<TInput extends ZodType, TSteps extends ReadonlyArray<AnyTypedStep>> = {
|
|
42
|
-
input: InputAccessor<Prettify<WithWorkItemFields<TInput["_output"]>>>;
|
|
43
|
-
signal: <S extends ElementOf<TSteps>>(step: S, key: S["__signalKeys"]) => StepSignalBinding;
|
|
44
|
-
output: <S extends ElementOf<TSteps>>(step: S) => StepOutputBinding;
|
|
45
|
-
literal: (value: unknown) => LiteralBinding;
|
|
46
|
-
};
|
|
47
|
-
type ReservedPipelineInputKeys = "workItemTitle" | "workItemDescription";
|
|
48
|
-
type NoReservedKeys<T extends ZodType> = T extends {
|
|
49
|
-
shape: infer Shape;
|
|
50
|
-
} ? [string & keyof Shape & ReservedPipelineInputKeys] extends [never] ? T : never : T;
|
|
51
|
-
export type PipelineMeta<TInput extends ZodType = z.ZodUnknown> = {
|
|
52
|
-
key: string;
|
|
53
|
-
name: string;
|
|
54
|
-
description?: string;
|
|
55
|
-
version?: number;
|
|
56
|
-
status?: "draft" | "active";
|
|
57
|
-
additionalPipelineInput?: {
|
|
58
|
-
schema: NoReservedKeys<TInput>;
|
|
59
|
-
bindings: (ctx: {
|
|
60
|
-
workItem: WorkItemAccessor;
|
|
61
|
-
literal: (value: unknown) => LiteralBinding;
|
|
62
|
-
}) => TInput["_output"] extends object ? {
|
|
63
|
-
[K in RequiredInputKeys<TInput["_output"]>]: AnyBinding;
|
|
64
|
-
} & {
|
|
65
|
-
[K in OptionalInputKeys<TInput["_output"]>]?: AnyBinding;
|
|
66
|
-
} : Partial<Record<string, AnyBinding>>;
|
|
67
|
-
};
|
|
68
|
-
additionalStepInput?: {
|
|
69
|
-
schema: ZodType;
|
|
70
|
-
bindings: (ctx: {
|
|
71
|
-
workItemField: (fieldName: string) => WorkItemBinding;
|
|
72
|
-
literal: (value: unknown) => LiteralBinding;
|
|
73
|
-
}) => Partial<Record<string, AdditionalStepInputBinding>>;
|
|
74
|
-
};
|
|
75
|
-
};
|
|
76
24
|
/**
|
|
77
25
|
* Returned by `.step()`. Requires `.advance()` before the pipeline can
|
|
78
26
|
* continue. Also accepts `.timeout()` before `.advance()`.
|
|
@@ -122,6 +70,5 @@ export declare class PipelineBuilder<TInput extends ZodType> {
|
|
|
122
70
|
}>(step: S, mapper?: (ctx: StepInputCtx<TInput, []>) => Partial<Record<string, AnyBinding>>, configFn?: (config: StepConfig) => void): PipelineStepAdvancementBuilder<TInput, [S]>;
|
|
123
71
|
step<S extends AnyTypedStep>(step: S, mapper: (ctx: StepInputCtx<TInput, []>) => StepInputMapping<S>, configFn?: (config: StepConfig) => void): PipelineStepAdvancementBuilder<TInput, [S]>;
|
|
124
72
|
}
|
|
125
|
-
export
|
|
73
|
+
export { literal } from "./builder-helpers";
|
|
126
74
|
export declare function pipeline<TInput extends ZodType = z.ZodUnknown>(meta: PipelineMeta<TInput>): PipelineBuilder<TInput>;
|
|
127
|
-
export {};
|
|
@@ -11478,7 +11478,7 @@ function finalize(ctx, schema) {
|
|
|
11478
11478
|
result.$schema = "http://json-schema.org/draft-07/schema#";
|
|
11479
11479
|
} else if (ctx.target === "draft-04") {
|
|
11480
11480
|
result.$schema = "http://json-schema.org/draft-04/schema#";
|
|
11481
|
-
} else if (ctx.target === "openapi-3.0") {}
|
|
11481
|
+
} else if (ctx.target === "openapi-3.0") {}
|
|
11482
11482
|
if (ctx.external?.uri) {
|
|
11483
11483
|
const id = ctx.external.registry.get(schema)?.id;
|
|
11484
11484
|
if (!id)
|
|
@@ -11722,7 +11722,7 @@ var literalProcessor = (schema, ctx, json, _params) => {
|
|
|
11722
11722
|
if (val === undefined) {
|
|
11723
11723
|
if (ctx.unrepresentable === "throw") {
|
|
11724
11724
|
throw new Error("Literal `undefined` cannot be represented in JSON Schema");
|
|
11725
|
-
}
|
|
11725
|
+
}
|
|
11726
11726
|
} else if (typeof val === "bigint") {
|
|
11727
11727
|
if (ctx.unrepresentable === "throw") {
|
|
11728
11728
|
throw new Error("BigInt literals cannot be represented in JSON Schema");
|
|
@@ -14643,6 +14643,82 @@ function materializeAccessor(accessor) {
|
|
|
14643
14643
|
};
|
|
14644
14644
|
}
|
|
14645
14645
|
|
|
14646
|
+
// src/definitions/pipelines/builder-helpers.ts
|
|
14647
|
+
var WORK_ITEM_ACCESSOR = Object.freeze({
|
|
14648
|
+
title: Object.freeze({ source: "work_item", field: "title" }),
|
|
14649
|
+
description: Object.freeze({
|
|
14650
|
+
source: "work_item",
|
|
14651
|
+
field: "description"
|
|
14652
|
+
}),
|
|
14653
|
+
field: (fieldName) => Object.freeze({ source: "work_item", field: `fields.${fieldName}` })
|
|
14654
|
+
});
|
|
14655
|
+
var WORK_ITEM_FIELD_BINDINGS = {
|
|
14656
|
+
workItemTitle: { source: "work_item", field: "title" },
|
|
14657
|
+
workItemDescription: { source: "work_item", field: "description" }
|
|
14658
|
+
};
|
|
14659
|
+
function makeStepInputCtx(inputSchema) {
|
|
14660
|
+
const baseAccessor = createInputAccessor(inputSchema);
|
|
14661
|
+
const input = new Proxy(baseAccessor, {
|
|
14662
|
+
get(target, prop) {
|
|
14663
|
+
if (typeof prop === "string" && prop in WORK_ITEM_FIELD_BINDINGS) {
|
|
14664
|
+
return WORK_ITEM_FIELD_BINDINGS[prop];
|
|
14665
|
+
}
|
|
14666
|
+
return target[prop];
|
|
14667
|
+
}
|
|
14668
|
+
});
|
|
14669
|
+
return {
|
|
14670
|
+
input,
|
|
14671
|
+
signal(step, key) {
|
|
14672
|
+
return { source: "step_signal", step, signalKey: key };
|
|
14673
|
+
},
|
|
14674
|
+
output(step) {
|
|
14675
|
+
return { source: "step_output", step };
|
|
14676
|
+
},
|
|
14677
|
+
literal: literal2
|
|
14678
|
+
};
|
|
14679
|
+
}
|
|
14680
|
+
function literal2(value) {
|
|
14681
|
+
return { source: "literal", value };
|
|
14682
|
+
}
|
|
14683
|
+
function normalizeInputMapping(mapping) {
|
|
14684
|
+
if (!mapping)
|
|
14685
|
+
return;
|
|
14686
|
+
const out = {};
|
|
14687
|
+
for (const [key, value] of Object.entries(mapping)) {
|
|
14688
|
+
if (value === undefined)
|
|
14689
|
+
continue;
|
|
14690
|
+
out[key] = isInputAccessor(value) ? materializeAccessor(value) : value;
|
|
14691
|
+
}
|
|
14692
|
+
return out;
|
|
14693
|
+
}
|
|
14694
|
+
function resolveAdditionalStepInputBindings(label, definition) {
|
|
14695
|
+
if (!definition) {
|
|
14696
|
+
return {};
|
|
14697
|
+
}
|
|
14698
|
+
const raw = definition.bindings({
|
|
14699
|
+
workItemField: (fieldName) => ({
|
|
14700
|
+
source: "work_item",
|
|
14701
|
+
field: `fields.${fieldName}`
|
|
14702
|
+
}),
|
|
14703
|
+
literal: literal2
|
|
14704
|
+
});
|
|
14705
|
+
if (definition.schema instanceof exports_external.ZodObject) {
|
|
14706
|
+
const validKeys = new Set(Object.keys(definition.schema.shape));
|
|
14707
|
+
const unknown2 = Object.keys(raw).filter((key) => !validKeys.has(key));
|
|
14708
|
+
if (unknown2.length > 0) {
|
|
14709
|
+
throw new Error(`${label}.bindings returned key${unknown2.length > 1 ? "s" : ""} not in schema: ${unknown2.map((key) => `"${key}"`).join(", ")}`);
|
|
14710
|
+
}
|
|
14711
|
+
}
|
|
14712
|
+
return normalizeInputMapping(raw) ?? {};
|
|
14713
|
+
}
|
|
14714
|
+
function mergeStepBindings(pipelineBindings, explicitBindings) {
|
|
14715
|
+
const merged = {
|
|
14716
|
+
...pipelineBindings,
|
|
14717
|
+
...explicitBindings ?? {}
|
|
14718
|
+
};
|
|
14719
|
+
return Object.keys(merged).length > 0 ? merged : undefined;
|
|
14720
|
+
}
|
|
14721
|
+
|
|
14646
14722
|
// src/definitions/pipelines/builder.ts
|
|
14647
14723
|
class PipelineStepAdvancementBuilder {
|
|
14648
14724
|
inputSchema;
|
|
@@ -14659,6 +14735,8 @@ class PipelineStepAdvancementBuilder {
|
|
|
14659
14735
|
}
|
|
14660
14736
|
advance(callback) {
|
|
14661
14737
|
const last = this.steps.at(-1);
|
|
14738
|
+
if (!last)
|
|
14739
|
+
throw new Error("Internal error: no steps available");
|
|
14662
14740
|
const ctx = makeAdvanceCtx();
|
|
14663
14741
|
const result = callback(ctx);
|
|
14664
14742
|
const policy = {
|
|
@@ -14755,80 +14833,6 @@ class PipelineBuilder {
|
|
|
14755
14833
|
return new PipelineStepAdvancementBuilder(this.inputSchema, this.meta, this.steps, this.pipelineInputBindings, this.pipelineStepInputBindings);
|
|
14756
14834
|
}
|
|
14757
14835
|
}
|
|
14758
|
-
var WORK_ITEM_ACCESSOR = Object.freeze({
|
|
14759
|
-
title: Object.freeze({ source: "work_item", field: "title" }),
|
|
14760
|
-
description: Object.freeze({
|
|
14761
|
-
source: "work_item",
|
|
14762
|
-
field: "description"
|
|
14763
|
-
}),
|
|
14764
|
-
field: (fieldName) => Object.freeze({ source: "work_item", field: `fields.${fieldName}` })
|
|
14765
|
-
});
|
|
14766
|
-
var WORK_ITEM_FIELD_BINDINGS = {
|
|
14767
|
-
workItemTitle: { source: "work_item", field: "title" },
|
|
14768
|
-
workItemDescription: { source: "work_item", field: "description" }
|
|
14769
|
-
};
|
|
14770
|
-
function makeStepInputCtx(inputSchema) {
|
|
14771
|
-
const baseAccessor = createInputAccessor(inputSchema);
|
|
14772
|
-
const input = new Proxy(baseAccessor, {
|
|
14773
|
-
get(target, prop) {
|
|
14774
|
-
if (typeof prop === "string" && prop in WORK_ITEM_FIELD_BINDINGS) {
|
|
14775
|
-
return WORK_ITEM_FIELD_BINDINGS[prop];
|
|
14776
|
-
}
|
|
14777
|
-
return target[prop];
|
|
14778
|
-
}
|
|
14779
|
-
});
|
|
14780
|
-
return {
|
|
14781
|
-
input,
|
|
14782
|
-
signal(step, key) {
|
|
14783
|
-
return { source: "step_signal", step, signalKey: key };
|
|
14784
|
-
},
|
|
14785
|
-
output(step) {
|
|
14786
|
-
return { source: "step_output", step };
|
|
14787
|
-
},
|
|
14788
|
-
literal: literal2
|
|
14789
|
-
};
|
|
14790
|
-
}
|
|
14791
|
-
function literal2(value) {
|
|
14792
|
-
return { source: "literal", value };
|
|
14793
|
-
}
|
|
14794
|
-
function normalizeInputMapping(mapping) {
|
|
14795
|
-
if (!mapping)
|
|
14796
|
-
return;
|
|
14797
|
-
const out = {};
|
|
14798
|
-
for (const [key, value] of Object.entries(mapping)) {
|
|
14799
|
-
if (value === undefined)
|
|
14800
|
-
continue;
|
|
14801
|
-
out[key] = isInputAccessor(value) ? materializeAccessor(value) : value;
|
|
14802
|
-
}
|
|
14803
|
-
return out;
|
|
14804
|
-
}
|
|
14805
|
-
function resolveAdditionalStepInputBindings(label, definition) {
|
|
14806
|
-
if (!definition) {
|
|
14807
|
-
return {};
|
|
14808
|
-
}
|
|
14809
|
-
const raw = definition.bindings({
|
|
14810
|
-
workItemField: (fieldName) => ({
|
|
14811
|
-
source: "work_item",
|
|
14812
|
-
field: `fields.${fieldName}`
|
|
14813
|
-
}),
|
|
14814
|
-
literal: literal2
|
|
14815
|
-
});
|
|
14816
|
-
if (definition.schema instanceof exports_external.ZodObject) {
|
|
14817
|
-
const validKeys = new Set(Object.keys(definition.schema.shape));
|
|
14818
|
-
const unknown2 = Object.keys(raw).filter((key) => !validKeys.has(key));
|
|
14819
|
-
if (unknown2.length > 0) {
|
|
14820
|
-
throw new Error(`${label}.bindings returned key${unknown2.length > 1 ? "s" : ""} not in schema: ${unknown2.map((key) => `"${key}"`).join(", ")}`);
|
|
14821
|
-
}
|
|
14822
|
-
}
|
|
14823
|
-
return normalizeInputMapping(raw) ?? {};
|
|
14824
|
-
}
|
|
14825
|
-
function mergeStepBindings(pipelineBindings, explicitBindings) {
|
|
14826
|
-
const merged = {
|
|
14827
|
-
...pipelineBindings,
|
|
14828
|
-
...explicitBindings ?? {}
|
|
14829
|
-
};
|
|
14830
|
-
return Object.keys(merged).length > 0 ? merged : undefined;
|
|
14831
|
-
}
|
|
14832
14836
|
function pipeline(meta3) {
|
|
14833
14837
|
return new PipelineBuilder(meta3);
|
|
14834
14838
|
}
|
|
@@ -15827,6 +15831,22 @@ class StepExecutions extends HeyApiClient {
|
|
|
15827
15831
|
getStepExecution(options) {
|
|
15828
15832
|
return (options.client ?? this.client).get({ url: "/api/step-executions/{stepExecutionId}", ...options });
|
|
15829
15833
|
}
|
|
15834
|
+
readStepExecutionLogs(options) {
|
|
15835
|
+
return (options.client ?? this.client).get({ url: "/api/step-executions/{stepExecutionId}/logs", ...options });
|
|
15836
|
+
}
|
|
15837
|
+
appendStepExecutionLogs(options) {
|
|
15838
|
+
return (options.client ?? this.client).post({
|
|
15839
|
+
url: "/api/step-executions/{stepExecutionId}/logs",
|
|
15840
|
+
...options,
|
|
15841
|
+
headers: {
|
|
15842
|
+
"Content-Type": "application/json",
|
|
15843
|
+
...options.headers
|
|
15844
|
+
}
|
|
15845
|
+
});
|
|
15846
|
+
}
|
|
15847
|
+
getStepExecutionLogArchive(options) {
|
|
15848
|
+
return (options.client ?? this.client).get({ url: "/api/step-executions/{stepExecutionId}/logs/archive", ...options });
|
|
15849
|
+
}
|
|
15830
15850
|
}
|
|
15831
15851
|
|
|
15832
15852
|
class PipelineDefinitions extends HeyApiClient {
|
|
@@ -16165,6 +16185,12 @@ class ProjectInvites extends HeyApiClient {
|
|
|
16165
16185
|
}
|
|
16166
16186
|
}
|
|
16167
16187
|
|
|
16188
|
+
class Billing extends HeyApiClient {
|
|
16189
|
+
getOrgUsage(options) {
|
|
16190
|
+
return (options.client ?? this.client).get({ url: "/api/orgs/{orgId}/usage", ...options });
|
|
16191
|
+
}
|
|
16192
|
+
}
|
|
16193
|
+
|
|
16168
16194
|
class BoboddyClient extends HeyApiClient {
|
|
16169
16195
|
static __registry = new HeyApiRegistry;
|
|
16170
16196
|
constructor(args) {
|
|
@@ -16227,6 +16253,10 @@ class BoboddyClient extends HeyApiClient {
|
|
|
16227
16253
|
get projectInvites() {
|
|
16228
16254
|
return this._projectInvites ??= new ProjectInvites({ client: this.client });
|
|
16229
16255
|
}
|
|
16256
|
+
_billing;
|
|
16257
|
+
get billing() {
|
|
16258
|
+
return this._billing ??= new Billing({ client: this.client });
|
|
16259
|
+
}
|
|
16230
16260
|
}
|
|
16231
16261
|
|
|
16232
16262
|
// src/definitions/pipelines/pipeline-definitions-client.ts
|
|
@@ -16243,7 +16273,7 @@ var buildPipelineDefinitionsClient = (pipelineDefinitions) => {
|
|
|
16243
16273
|
});
|
|
16244
16274
|
if (result.error)
|
|
16245
16275
|
throw new Error(JSON.stringify(result.error));
|
|
16246
|
-
return result.data
|
|
16276
|
+
return result.data;
|
|
16247
16277
|
},
|
|
16248
16278
|
upsertFromSpec: async (projectId, spec, stepDefs, options) => {
|
|
16249
16279
|
const stepDefMap = new Map;
|
|
@@ -16323,7 +16353,7 @@ function makeFieldRef(fact, path) {
|
|
|
16323
16353
|
};
|
|
16324
16354
|
}
|
|
16325
16355
|
function makeAssign(pipeline2) {
|
|
16326
|
-
if (typeof pipeline2 !== "object" ||
|
|
16356
|
+
if (typeof pipeline2 !== "object" || typeof pipeline2["key"] !== "string" || !Array.isArray(pipeline2["steps"])) {
|
|
16327
16357
|
throw new Error("assign() requires a pipeline spec produced by pipeline().build(). " + "Pass the default-exported value from a pipeline definition file.");
|
|
16328
16358
|
}
|
|
16329
16359
|
return { _tag: "assign", pipeline: pipeline2 };
|
|
@@ -16372,13 +16402,10 @@ function serializeConditionNode(condition) {
|
|
|
16372
16402
|
value: condition.value
|
|
16373
16403
|
};
|
|
16374
16404
|
}
|
|
16375
|
-
if (condition.
|
|
16376
|
-
|
|
16377
|
-
return { all: condition.conditions.map(serializeConditionNode) };
|
|
16378
|
-
}
|
|
16379
|
-
return { any: condition.conditions.map(serializeConditionNode) };
|
|
16405
|
+
if (condition.mode === "all") {
|
|
16406
|
+
return { all: condition.conditions.map(serializeConditionNode) };
|
|
16380
16407
|
}
|
|
16381
|
-
|
|
16408
|
+
return { any: condition.conditions.map(serializeConditionNode) };
|
|
16382
16409
|
}
|
|
16383
16410
|
function serializeOutcome(outcome) {
|
|
16384
16411
|
if (outcome._tag === "skip")
|
|
@@ -11235,7 +11235,7 @@ function finalize(ctx, schema) {
|
|
|
11235
11235
|
result.$schema = "http://json-schema.org/draft-07/schema#";
|
|
11236
11236
|
} else if (ctx.target === "draft-04") {
|
|
11237
11237
|
result.$schema = "http://json-schema.org/draft-04/schema#";
|
|
11238
|
-
} else if (ctx.target === "openapi-3.0") {}
|
|
11238
|
+
} else if (ctx.target === "openapi-3.0") {}
|
|
11239
11239
|
if (ctx.external?.uri) {
|
|
11240
11240
|
const id = ctx.external.registry.get(schema)?.id;
|
|
11241
11241
|
if (!id)
|
|
@@ -11479,7 +11479,7 @@ var literalProcessor = (schema, ctx, json, _params) => {
|
|
|
11479
11479
|
if (val === undefined) {
|
|
11480
11480
|
if (ctx.unrepresentable === "throw") {
|
|
11481
11481
|
throw new Error("Literal `undefined` cannot be represented in JSON Schema");
|
|
11482
|
-
}
|
|
11482
|
+
}
|
|
11483
11483
|
} else if (typeof val === "bigint") {
|
|
11484
11484
|
if (ctx.unrepresentable === "throw") {
|
|
11485
11485
|
throw new Error("BigInt literals cannot be represented in JSON Schema");
|
|
@@ -11984,29 +11984,29 @@ function renderPromptTemplate(template, contextJson) {
|
|
|
11984
11984
|
}
|
|
11985
11985
|
|
|
11986
11986
|
// src/definitions/steps/define-step.ts
|
|
11987
|
-
|
|
11988
|
-
|
|
11989
|
-
|
|
11990
|
-
|
|
11991
|
-
|
|
11992
|
-
|
|
11993
|
-
|
|
11987
|
+
function resolveZodSchemaAtPath(schema, path) {
|
|
11988
|
+
if (!schema)
|
|
11989
|
+
return;
|
|
11990
|
+
const segments = path.split(".");
|
|
11991
|
+
let current = schema;
|
|
11992
|
+
for (const segment of segments) {
|
|
11993
|
+
if (!current)
|
|
11994
|
+
return;
|
|
11995
|
+
current = unwrapZodWrappers(current);
|
|
11996
|
+
const def = current.def;
|
|
11997
|
+
if (!def || def.type !== "object" || !def.shape)
|
|
11998
|
+
return;
|
|
11999
|
+
current = def.shape[segment];
|
|
11994
12000
|
}
|
|
11995
|
-
return
|
|
12001
|
+
return current;
|
|
11996
12002
|
}
|
|
11997
|
-
function
|
|
12003
|
+
function zodTypeToSignalType(schema) {
|
|
11998
12004
|
if (!schema)
|
|
11999
|
-
return
|
|
12000
|
-
|
|
12001
|
-
|
|
12002
|
-
|
|
12003
|
-
|
|
12004
|
-
const next = current._def.shape?.[part];
|
|
12005
|
-
if (!next)
|
|
12006
|
-
return "string";
|
|
12007
|
-
current = unwrapZodType(next);
|
|
12008
|
-
}
|
|
12009
|
-
switch (current._def.type) {
|
|
12005
|
+
return;
|
|
12006
|
+
const unwrapped = unwrapZodWrappers(schema);
|
|
12007
|
+
const def = unwrapped.def;
|
|
12008
|
+
const typeName = def?.type;
|
|
12009
|
+
switch (typeName) {
|
|
12010
12010
|
case "string":
|
|
12011
12011
|
return "string";
|
|
12012
12012
|
case "number":
|
|
@@ -12016,12 +12016,21 @@ function deriveSignalType(schema, path) {
|
|
|
12016
12016
|
case "array":
|
|
12017
12017
|
return "array";
|
|
12018
12018
|
case "object":
|
|
12019
|
-
case "record":
|
|
12020
12019
|
return "object";
|
|
12021
12020
|
default:
|
|
12022
|
-
return
|
|
12021
|
+
return;
|
|
12023
12022
|
}
|
|
12024
12023
|
}
|
|
12024
|
+
function unwrapZodWrappers(schema) {
|
|
12025
|
+
const def = schema.def;
|
|
12026
|
+
if (!def)
|
|
12027
|
+
return schema;
|
|
12028
|
+
if (def.type === "optional" || def.type === "nullable" || def.type === "default" || def.type === "catch") {
|
|
12029
|
+
if (def.innerType)
|
|
12030
|
+
return unwrapZodWrappers(def.innerType);
|
|
12031
|
+
}
|
|
12032
|
+
return schema;
|
|
12033
|
+
}
|
|
12025
12034
|
function defineStep(config2) {
|
|
12026
12035
|
const features = config2.features ?? [];
|
|
12027
12036
|
let effectiveResult = config2.result;
|
|
@@ -12052,7 +12061,7 @@ ${feature._promptAddition}` : feature._promptAddition;
|
|
|
12052
12061
|
...(config2.signals ?? []).map((s) => ({
|
|
12053
12062
|
key: s.key ?? s.sourcePath,
|
|
12054
12063
|
sourcePath: s.sourcePath,
|
|
12055
|
-
type: s.type ??
|
|
12064
|
+
type: s.type ?? zodTypeToSignalType(resolveZodSchemaAtPath(effectiveResult, s.sourcePath)) ?? "string",
|
|
12056
12065
|
required: s.required ?? true,
|
|
12057
12066
|
availableWhenResultStatusIn: s.availableWhenResultStatusIn ?? null
|
|
12058
12067
|
})),
|
|
@@ -13064,6 +13073,22 @@ class StepExecutions extends HeyApiClient {
|
|
|
13064
13073
|
getStepExecution(options) {
|
|
13065
13074
|
return (options.client ?? this.client).get({ url: "/api/step-executions/{stepExecutionId}", ...options });
|
|
13066
13075
|
}
|
|
13076
|
+
readStepExecutionLogs(options) {
|
|
13077
|
+
return (options.client ?? this.client).get({ url: "/api/step-executions/{stepExecutionId}/logs", ...options });
|
|
13078
|
+
}
|
|
13079
|
+
appendStepExecutionLogs(options) {
|
|
13080
|
+
return (options.client ?? this.client).post({
|
|
13081
|
+
url: "/api/step-executions/{stepExecutionId}/logs",
|
|
13082
|
+
...options,
|
|
13083
|
+
headers: {
|
|
13084
|
+
"Content-Type": "application/json",
|
|
13085
|
+
...options.headers
|
|
13086
|
+
}
|
|
13087
|
+
});
|
|
13088
|
+
}
|
|
13089
|
+
getStepExecutionLogArchive(options) {
|
|
13090
|
+
return (options.client ?? this.client).get({ url: "/api/step-executions/{stepExecutionId}/logs/archive", ...options });
|
|
13091
|
+
}
|
|
13067
13092
|
}
|
|
13068
13093
|
|
|
13069
13094
|
class PipelineDefinitions extends HeyApiClient {
|
|
@@ -13402,6 +13427,12 @@ class ProjectInvites extends HeyApiClient {
|
|
|
13402
13427
|
}
|
|
13403
13428
|
}
|
|
13404
13429
|
|
|
13430
|
+
class Billing extends HeyApiClient {
|
|
13431
|
+
getOrgUsage(options) {
|
|
13432
|
+
return (options.client ?? this.client).get({ url: "/api/orgs/{orgId}/usage", ...options });
|
|
13433
|
+
}
|
|
13434
|
+
}
|
|
13435
|
+
|
|
13405
13436
|
class BoboddyClient extends HeyApiClient {
|
|
13406
13437
|
static __registry = new HeyApiRegistry;
|
|
13407
13438
|
constructor(args) {
|
|
@@ -13464,6 +13495,10 @@ class BoboddyClient extends HeyApiClient {
|
|
|
13464
13495
|
get projectInvites() {
|
|
13465
13496
|
return this._projectInvites ??= new ProjectInvites({ client: this.client });
|
|
13466
13497
|
}
|
|
13498
|
+
_billing;
|
|
13499
|
+
get billing() {
|
|
13500
|
+
return this._billing ??= new Billing({ client: this.client });
|
|
13501
|
+
}
|
|
13467
13502
|
}
|
|
13468
13503
|
|
|
13469
13504
|
// src/definitions/steps/step-definitions-client.ts
|
|
@@ -15864,7 +15899,7 @@ var notificationItemSchema = exports_external.object({
|
|
|
15864
15899
|
title: exports_external.string().describe("Short, human-readable notification title."),
|
|
15865
15900
|
body: exports_external.string().describe("The notification body / details."),
|
|
15866
15901
|
priority: exports_external.enum(["low", "normal", "high", "urgent"]).describe("How important this notification is for the user."),
|
|
15867
|
-
suggestedChannels: exports_external.array(exports_external.enum(["in_app", "
|
|
15902
|
+
suggestedChannels: exports_external.array(exports_external.enum(["in_app", "work_item_platform_comment", "email", "slack"])).optional().describe("Channels the agent thinks are worth using. The platform policy decides the final channels."),
|
|
15868
15903
|
payload: exports_external.record(exports_external.string(), exports_external.unknown()).optional().describe('Kind-specific structured data. For "feedback_request": { category, urgency, suggestedKey? }.')
|
|
15869
15904
|
}).describe("A single user notification emitted by the agent.");
|
|
15870
15905
|
var notificationsFeature = {
|
|
@@ -15880,7 +15915,7 @@ var notificationsFeature = {
|
|
|
15880
15915
|
"- **title**: A short, human-readable title.",
|
|
15881
15916
|
"- **body**: The details of the notification.",
|
|
15882
15917
|
"- **priority**: One of `low`, `normal`, `high`, `urgent`.",
|
|
15883
|
-
'- **suggestedChannels** *(optional)*: Channels you think are worth using (e.g. `["in_app", "
|
|
15918
|
+
'- **suggestedChannels** *(optional)*: Channels you think are worth using (e.g. `["in_app", "work_item_platform_comment"]`).',
|
|
15884
15919
|
" You only *suggest* channels \u2014 the platform policy decides the final delivery channels.",
|
|
15885
15920
|
'- **payload** *(optional)*: Kind-specific data. For `feedback_request`, include `{ "category": string, "urgency": "blocking"|"clarification"|"assumption"|"informational", "suggestedKey"?: string }`.'
|
|
15886
15921
|
].join(`
|