@usepipr/sdk 0.1.3 → 0.2.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.
- package/README.md +26 -0
- package/dist/{index-DMjdjJV4.d.mts → index-oc6nXCw8.d.mts} +200 -161
- package/dist/index-oc6nXCw8.d.mts.map +1 -0
- package/dist/index.d.mts +2 -2
- package/dist/index.mjs +628 -1
- package/dist/index.mjs.map +1 -0
- package/dist/internal.d.mts +16 -5
- package/dist/internal.d.mts.map +1 -1
- package/dist/internal.mjs +2 -4
- package/dist/internal.mjs.map +1 -1
- package/dist/prompt-render-BWiLG-qu.mjs +52 -0
- package/dist/prompt-render-BWiLG-qu.mjs.map +1 -0
- package/package.json +4 -12
- package/dist/index-DMjdjJV4.d.mts.map +0 -1
- package/dist/prompt-render-CHlrR9Sa.mjs +0 -13
- package/dist/prompt-render-CHlrR9Sa.mjs.map +0 -1
- package/dist/review.d.mts +0 -2
- package/dist/review.mjs +0 -2
- package/dist/src-CR3NktDT.mjs +0 -599
- package/dist/src-CR3NktDT.mjs.map +0 -1
- package/dist/tools.d.mts +0 -2
- package/dist/tools.mjs +0 -1
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"src-CR3NktDT.mjs","names":["coreReviewResultSchema","coreReviewSummarySchema"],"sources":["../src/prompt.ts","../src/review-contract.ts","../src/schema.ts","../src/builder.ts"],"sourcesContent":["import type { Markdown } from \"./index.js\";\n\n/** Creates trimmed Markdown from a template literal with common indentation removed. */\nexport function md(strings: TemplateStringsArray, ...values: unknown[]): Markdown {\n let text = \"\";\n for (let index = 0; index < strings.length; index += 1) {\n text += strings[index] ?? \"\";\n if (index < values.length) {\n text += String(values[index] ?? \"\");\n }\n }\n return stripCommonIndent(text).trim();\n}\n\n/** Removes common leading indentation from multiline text. */\nexport function stripCommonIndent(value: string): string {\n const lines = value.replaceAll(\"\\t\", \" \").split(/\\r?\\n/);\n const nonEmpty = lines.filter((line) => line.trim().length > 0);\n const indent = Math.min(...nonEmpty.map((line) => line.match(/^ */)?.[0].length ?? 0));\n return lines.map((line) => line.slice(indent)).join(\"\\n\");\n}\n","import { z } from \"zod\";\nimport type { ZodSchema } from \"./index.js\";\n\n/** Markdown summary produced by a reviewer for the main review comment. */\nexport type ReviewSummary = {\n title?: string;\n body: string;\n};\n\n/** One inline review finding targeting a Diff Manifest commentable range. */\nexport type ReviewFinding = {\n body: string;\n path: string;\n rangeId: string;\n side: \"RIGHT\" | \"LEFT\";\n startLine: number;\n endLine: number;\n suggestedFix?: string;\n};\n\n/** Core structured review result accepted by pipr review publication. */\nexport type ReviewResult = {\n summary: ReviewSummary;\n inlineFindings: ReviewFinding[];\n};\n\nconst nonEmptyStringSchema = z.string().min(1);\nconst positiveIntegerSchema = z.number().int().positive();\n\n/** Zod schema for a review summary. */\nexport const reviewSummarySchema: ZodSchema<ReviewSummary> = z.strictObject({\n title: nonEmptyStringSchema.optional(),\n body: nonEmptyStringSchema,\n});\n\n/** Zod schema for one inline review finding. */\nexport const reviewFindingSchema: ZodSchema<ReviewFinding> = z.strictObject({\n body: nonEmptyStringSchema,\n path: nonEmptyStringSchema,\n rangeId: nonEmptyStringSchema,\n side: z.enum([\"RIGHT\", \"LEFT\"]),\n startLine: positiveIntegerSchema,\n endLine: positiveIntegerSchema,\n suggestedFix: nonEmptyStringSchema.optional(),\n});\n\n/** Zod schema for pipr's core pull request review result. */\nexport const reviewResultSchema: ZodSchema<ReviewResult> = z.strictObject({\n summary: reviewSummarySchema,\n inlineFindings: z.array(reviewFindingSchema),\n});\n\n/** Parses model output for pipr's main pull request review schema. */\nexport function parseReviewResult(value: unknown): ReviewResult {\n return reviewResultSchema.parse(value) as ReviewResult;\n}\n\n/** Parses a review summary value. */\nexport function parseReviewSummary(value: unknown): ReviewSummary {\n return reviewSummarySchema.parse(value);\n}\n\n/** Parses one inline review finding. */\nexport function parseReviewFinding(value: unknown): ReviewFinding {\n return reviewFindingSchema.parse(value) as ReviewFinding;\n}\n\n/** Returns a small valid example for the main pull request review schema. */\nexport function reviewSchemaExample(): ReviewResult {\n return {\n summary: {\n title: \"Optional concise review title.\",\n body: \"Concise pull request review summary.\",\n },\n inlineFindings: [\n {\n body: \"Specific issue and why it matters.\",\n path: \"src/example.ts\",\n rangeId: \"rng_example\",\n side: \"RIGHT\",\n startLine: 1,\n endLine: 1,\n suggestedFix: \"return safeValue;\",\n },\n ],\n };\n}\n","import { z } from \"zod\";\nimport type {\n BuiltinSchemaCatalog,\n JsonSchema,\n JsonSchemaDefinition,\n Schema,\n SchemaDefinition,\n ZodSchema,\n} from \"./index.js\";\nimport type { ReviewResult, ReviewSummary } from \"./review-contract.js\";\nimport {\n reviewResultSchema as coreReviewResultSchema,\n reviewSummarySchema as coreReviewSummarySchema,\n} from \"./review-contract.js\";\n\nconst coreReviewOutputSchemaId = \"core/pr-review\";\n\n/** Defines a typed schema from a Zod schema. */\nexport function schema<T>(definition: SchemaDefinition<T>): Schema<T> {\n if (!definition || typeof definition.id !== \"string\") {\n throw new Error(\"pipr.schema requires { id, schema }\");\n }\n assertUserSchemaId(definition.id);\n return createZodSchema(definition.id, definition.schema);\n}\n\n/** Defines a typed schema from JSON Schema. The generic type is caller supplied. */\nexport function jsonSchema<T>(definition: JsonSchemaDefinition): Schema<T> {\n if (!definition || typeof definition.id !== \"string\") {\n throw new Error(\"pipr.jsonSchema requires { id, schema }\");\n }\n assertUserSchemaId(definition.id);\n const zodSchema = z.fromJSONSchema(definition.schema);\n return createSchema(definition.id, (value) => zodSchema.parse(value) as T, definition.schema);\n}\n\n/** Built-in schemas available as reusable agent output contracts. */\nexport const schemas: BuiltinSchemaCatalog = {\n review: createZodSchema<ReviewResult>(coreReviewOutputSchemaId, coreReviewResultSchema),\n summary: createZodSchema<ReviewSummary>(\"core/summary\", coreReviewSummarySchema),\n};\n\nfunction createSchema<T>(\n id: string,\n parseValue: (value: unknown) => T,\n schemaJson?: JsonSchema,\n): Schema<T> {\n return {\n kind: \"pipr.schema\",\n id,\n jsonSchema: schemaJson,\n parse(value) {\n return parseValue(value);\n },\n safeParse(value) {\n try {\n return { success: true, data: parseValue(value) };\n } catch (error) {\n return {\n success: false,\n error: error instanceof Error ? error : new Error(String(error)),\n };\n }\n },\n };\n}\n\nfunction createZodSchema<T>(id: string, zodSchema: ZodSchema<T>): Schema<T> {\n return createSchema(id, (value) => zodSchema.parse(value), jsonSchemaFromZod(id, zodSchema));\n}\n\nfunction assertUserSchemaId(id: string): void {\n if (id.startsWith(\"core/\")) {\n throw new Error(`Schema id '${id}' uses the reserved core/ namespace`);\n }\n}\n\nfunction jsonSchemaFromZod<T>(id: string, schemaDefinition: ZodSchema<T>): JsonSchema {\n try {\n return z.toJSONSchema(schemaDefinition) as JsonSchema;\n } catch (error) {\n const detail = error instanceof Error ? error.message : String(error);\n throw new Error(\n `Schema '${id}' could not be converted to JSON Schema. Use JSON-Schema-representable Zod or pipr.jsonSchema<T>(). ${detail}`,\n );\n }\n}\n","import type {\n Agent,\n AgentDefinition,\n AgentTool,\n ChangeRequestAction,\n ChecksOptions,\n CommandOptions,\n CommentValue,\n DefaultReviewInput,\n Markdown,\n ModelProfile,\n PiprBuilder,\n PiprPlugin,\n PublicationOptions,\n ReviewEntrypoints,\n Reviewer,\n ReviewerOptions,\n ReviewRecipeOptions,\n RuntimeLimits,\n Task,\n ToolRunOptions,\n} from \"./index.js\";\nimport { stripCommonIndent } from \"./prompt.js\";\nimport { renderPromptValue } from \"./prompt-render.js\";\nimport type { ReviewResult } from \"./review-contract.js\";\nimport type { RuntimePlan } from \"./runtime-contract.js\";\nimport { jsonSchema, schema, schemas } from \"./schema.js\";\n\nconst configFactoryBrand = Symbol.for(\"pipr.config.factory\");\nconst builtinReadOnlyToolBrand = Symbol.for(\"pipr.builtin.readOnlyTool\");\n\ntype InternalPiprConfigFactory = {\n readonly kind: \"pipr.config-factory\";\n readonly [configFactoryBrand]: true;\n build(): RuntimePlan;\n};\n\n/** Defines a synchronous pipr configuration factory. */\nexport function definePipr(configure: (pipr: PiprBuilder) => void): {\n readonly kind: \"pipr.config-factory\";\n} {\n const factory = {\n kind: \"pipr.config-factory\",\n [configFactoryBrand]: true,\n build() {\n const builder = createBuilder();\n const result = configure(builder.api);\n if (\n typeof result === \"object\" &&\n result !== null &&\n typeof Reflect.get(result, \"then\") === \"function\"\n ) {\n throw new Error(\"definePipr configuration callback must be synchronous\");\n }\n return builder.plan();\n },\n } satisfies InternalPiprConfigFactory;\n return factory;\n}\n\n/** Defines a typed pipr plugin installer. */\nexport function definePlugin<Handle>(setup: (builder: PiprBuilder) => Handle): PiprPlugin<Handle> {\n return { setup };\n}\n\nfunction createBuilder(): { api: PiprBuilder; plan(): RuntimePlan } {\n const models: ModelProfile[] = [];\n const agents: Agent[] = [];\n const tasks: Task<unknown>[] = [];\n const changeRequestTriggers: RuntimePlan[\"changeRequestTriggers\"] = [];\n const commands: RuntimePlan[\"commands\"] = [];\n const tools: AgentTool[] = [];\n const publication: RuntimePlan[\"publication\"] = {};\n let checks: ChecksOptions | undefined;\n let limits: RuntimeLimits | undefined;\n\n const api: PiprBuilder = {\n tools: {\n readOnly: [\n {\n kind: \"pipr.tool\",\n name: \"readOnly\",\n [builtinReadOnlyToolBrand]: true,\n } as AgentTool,\n ],\n },\n schemas,\n on: {\n changeRequest(options) {\n if (!Array.isArray(options.actions) || !options.task) {\n throw new Error(\"pipr.on.changeRequest requires { actions, task }\");\n }\n changeRequestTriggers.push({\n actions: options.actions,\n task: options.task as Task<unknown>,\n });\n },\n },\n secret(options) {\n if (!options || typeof options.name !== \"string\") {\n throw new Error(\"pipr.secret requires { name }\");\n }\n if (!/^[A-Z_][A-Z0-9_]*$/.test(options.name)) {\n throw new Error(`Secret '${options.name}' must be an environment variable name`);\n }\n return { kind: \"pipr.secret\", name: options.name };\n },\n model(options) {\n if (!options || typeof options.provider !== \"string\" || typeof options.model !== \"string\") {\n throw new Error(\"pipr.model requires { provider, model }\");\n }\n if (!options.provider || !options.model) {\n throw new Error(\"pipr.model requires provider and model\");\n }\n const id = options.id ?? `${options.provider}/${options.model}`;\n const profile: ModelProfile = {\n kind: \"pipr.model\",\n id,\n provider: options.provider,\n model: options.model,\n apiKey: options.apiKey,\n options: options.options,\n };\n models.push(profile);\n return profile;\n },\n agent(definition) {\n const agent = createAgent(definition);\n agents.push(agent);\n return agent;\n },\n task(definition) {\n if (!definition.name || typeof definition.run !== \"function\") {\n throw new Error(\"pipr.task requires { name, run }\");\n }\n const task = {\n kind: \"pipr.task\" as const,\n name: definition.name,\n check: definition.check,\n ...(definition.local === false ? { local: false as const } : {}),\n handler: definition.run,\n };\n tasks.push(task as Task<unknown>);\n return task;\n },\n reviewer(options) {\n return createReviewer(api, options);\n },\n review(options) {\n assertKnownReviewRecipeOptions(options);\n registerReviewRecipe(api, publication, options);\n },\n config(options) {\n if (!options || typeof options !== \"object\") {\n throw new Error(\"pipr.config requires an options object\");\n }\n mergePublicationConfig(publication, options.publication);\n checks = mergeConfigField(\"checks\", checks, options.checks);\n limits = mergeLimits(limits, options.limits);\n },\n command(options) {\n if (typeof options.pattern !== \"string\" || !options.task) {\n throw new Error(\"pipr.command requires { pattern, task }\");\n }\n const pattern = options.pattern;\n const tokens = pattern.trim().split(/\\s+/).filter(Boolean);\n if (tokens.length === 0) {\n throw new Error(\"Command pattern must not be empty\");\n }\n if (tokens[0] !== \"@pipr\") {\n throw new Error(`Command pattern '${pattern}' must start with @pipr`);\n }\n assertSupportedCommandRestCapture(pattern);\n commands.push({\n pattern,\n permission: options.permission ?? \"write\",\n description: options.description,\n parse: options.parse as ((arguments_: Record<string, string>) => unknown) | undefined,\n task: options.task as Task<unknown>,\n });\n },\n checks(options) {\n checks = mergeConfigField(\"checks\", checks, options);\n },\n limits(options) {\n limits = mergeLimits(limits, options);\n },\n use(plugin) {\n return plugin.setup(api);\n },\n tool(definition) {\n if (definition.name === \"readOnly\") {\n throw new Error(\"Tool name 'readOnly' is reserved for pipr built-in tools\");\n }\n const execute = definition.execute;\n let run = definition.run;\n if (!run && !execute) {\n throw new Error(`Tool '${definition.name}' must define run`);\n }\n if (!run) {\n const executeTool = execute;\n if (!executeTool) {\n throw new Error(`Tool '${definition.name}' must define run`);\n }\n run = (options: ToolRunOptions<unknown>) =>\n executeTool(options.ctx, options.input as never);\n }\n const tool = {\n kind: \"pipr.tool\" as const,\n ...definition,\n run,\n };\n tools.push(tool);\n return tool;\n },\n schema,\n jsonSchema,\n prompt(strings, ...values) {\n let text = \"\";\n for (let index = 0; index < strings.length; index += 1) {\n text += strings[index] ?? \"\";\n if (index < values.length) {\n text += renderPromptValue(values[index]);\n }\n }\n return {\n kind: \"pipr.prompt\",\n value: stripCommonIndent(text).trim(),\n };\n },\n section(title, value) {\n const rendered = renderPromptValue(value);\n return {\n kind: \"pipr.prompt\",\n value: `## ${title}\\n\\n${rendered}`,\n };\n },\n json(value, options) {\n const text = JSON.stringify(value, null, options?.pretty === false ? 0 : 2);\n if (options?.maxCharacters !== undefined && text.length > options.maxCharacters) {\n throw new Error(`JSON prompt value exceeded ${options.maxCharacters} characters`);\n }\n return { kind: \"pipr.prompt\", value: text };\n },\n };\n\n return {\n api,\n plan() {\n assertUnique(\n tasks.map((task) => task.name),\n \"task\",\n );\n assertUnique(\n commands.map((command) => command.pattern),\n \"command\",\n );\n assertModelIdentity(models);\n return {\n models,\n agents,\n tasks,\n changeRequestTriggers,\n commands,\n tools,\n publication,\n checks,\n limits,\n };\n },\n };\n}\n\nfunction registerReviewRecipe(\n api: PiprBuilder,\n publication: RuntimePlan[\"publication\"],\n options: ReviewRecipeOptions,\n): void {\n const id = options.id;\n const agent = options.reviewer ?? createReviewer(api, reviewRecipeReviewerOptions(options, id));\n\n const task = createReviewRecipeTask(api, id, agent, options);\n registerReviewRecipeEntrypoints(api, task, options);\n updateReviewRecipePublication(publication, options);\n}\n\nconst reviewRecipeOptionKeys = new Set([\n \"id\",\n \"entrypoints\",\n \"inlineComments\",\n \"comment\",\n \"check\",\n \"timeout\",\n \"paths\",\n \"reviewer\",\n \"name\",\n \"model\",\n \"fallbacks\",\n \"instructions\",\n \"prompt\",\n \"tools\",\n]);\n\nconst reviewRecipeEntrypointKeys = new Set([\"changeRequest\", \"command\"]);\n\nfunction assertKnownReviewRecipeOptions(options: ReviewRecipeOptions): void {\n const unknownKeys = Object.keys(options).filter((key) => !reviewRecipeOptionKeys.has(key));\n if (unknownKeys.length > 0) {\n throw new Error(`pipr.review received unsupported option fields: ${unknownKeys.join(\", \")}.`);\n }\n\n const entrypoints = options.entrypoints;\n if (entrypoints && typeof entrypoints === \"object\") {\n const unknownEntrypointKeys = Object.keys(entrypoints).filter(\n (key) => !reviewRecipeEntrypointKeys.has(key),\n );\n if (unknownEntrypointKeys.length > 0) {\n throw new Error(\n `pipr.review entrypoints received unsupported fields: ${unknownEntrypointKeys.join(\", \")}.`,\n );\n }\n }\n}\n\nfunction reviewRecipeReviewerOptions(options: ReviewerOptions, name: string): ReviewerOptions {\n if (!options.model || !options.instructions) {\n throw new Error(\"pipr.review requires model and instructions when reviewer is not provided\");\n }\n return {\n name,\n model: options.model,\n fallbacks: options.fallbacks,\n instructions: options.instructions,\n prompt: options.prompt,\n tools: options.tools,\n timeout: options.timeout,\n };\n}\n\nfunction createReviewer(api: PiprBuilder, options: ReviewerOptions): Reviewer {\n return api.agent<DefaultReviewInput, ReviewResult>({\n name: options.name ?? \"reviewer\",\n model: options.model,\n fallbacks: options.fallbacks,\n instructions: options.instructions,\n tools: options.tools ?? api.tools.readOnly,\n output: api.schemas.review,\n timeout: options.timeout,\n prompt:\n options.prompt ??\n (() =>\n api.prompt`\n Review this change.\n `),\n });\n}\n\nfunction createReviewRecipeTask(\n api: PiprBuilder,\n id: string,\n agent: Agent<DefaultReviewInput, ReviewResult>,\n options: ReviewRecipeOptions,\n): Task {\n return api.task({\n name: id,\n check: options.check,\n async run(context) {\n const manifest = await context.change.diffManifest({\n compressed: true,\n paths: options.paths,\n });\n if (options.paths && manifest.files.length === 0) {\n context.check.neutral(\"No changed files matched this review's path scope.\");\n await context.comment({ main: \"No changed files matched this review's path scope.\" });\n return;\n }\n const result = await context.pi.run(\n agent,\n { manifest, change: context.change },\n {\n timeout: options.timeout,\n paths: options.paths,\n },\n );\n const source =\n typeof options.comment === \"function\"\n ? await options.comment(result, {\n review: { id },\n repository: context.repository,\n change: context.change,\n platform: context.platform,\n })\n : (options.comment ?? defaultReviewComment(result, options.inlineComments !== false));\n await context.comment(source);\n },\n });\n}\n\nfunction defaultReviewComment(result: ReviewResult, includeInlineFindings: boolean): CommentValue {\n return {\n main: includeInlineFindings ? defaultReviewMarkdown(result) : result.summary.body,\n ...(includeInlineFindings ? { inlineFindings: result.inlineFindings } : {}),\n };\n}\n\nfunction defaultReviewMarkdown(result: ReviewResult): Markdown {\n const findings =\n result.inlineFindings.length === 0\n ? \"No inline findings.\"\n : result.inlineFindings.map((finding) => `- ${finding.body}`).join(\"\\n\");\n return `## Summary\\n\\n${result.summary.body}\\n\\n## Findings\\n\\n${findings}`;\n}\n\nfunction registerReviewRecipeEntrypoints(\n api: PiprBuilder,\n task: Task,\n options: ReviewRecipeOptions,\n): void {\n const changeRequest = reviewChangeRequestEntrypoint(options);\n if (changeRequest) {\n api.on.changeRequest({ actions: changeRequest, task });\n }\n const command = reviewCommandEntrypoint(options);\n if (command) {\n api.command({ pattern: command.pattern, ...command.options, task });\n }\n}\n\nfunction reviewChangeRequestEntrypoint(\n options: ReviewRecipeOptions,\n): ChangeRequestAction[] | undefined {\n const entrypoint = options.entrypoints?.changeRequest;\n return entrypoint === false\n ? undefined\n : (entrypoint ?? [\"opened\", \"updated\", \"reopened\", \"ready\"]);\n}\n\nfunction reviewCommandEntrypoint(options: ReviewRecipeOptions):\n | {\n pattern: string;\n options: CommandOptions<unknown>;\n }\n | undefined {\n const entrypoint = options.entrypoints?.command;\n if (entrypoint === false) {\n return undefined;\n }\n if (typeof entrypoint === \"object\") {\n return reviewObjectCommandEntrypoint(entrypoint);\n }\n return reviewStringCommandEntrypoint(entrypoint);\n}\n\nfunction reviewObjectCommandEntrypoint(\n entrypoint: Exclude<ReviewEntrypoints[\"command\"], string | false | undefined>,\n) {\n return {\n pattern: entrypoint.pattern ?? \"@pipr review\",\n options: {\n permission: entrypoint.permission ?? \"write\",\n description: entrypoint.description,\n },\n };\n}\n\nfunction reviewStringCommandEntrypoint(entrypoint: string | undefined) {\n return {\n pattern: entrypoint ?? \"@pipr review\",\n options: { permission: \"write\" as const },\n };\n}\n\nfunction updateReviewRecipePublication(\n publication: RuntimePlan[\"publication\"],\n options: ReviewRecipeOptions,\n): void {\n const maxInlineComments =\n options.inlineComments === false ? 0 : (options.inlineComments?.max ?? 5);\n if (\n publication.maxInlineComments !== undefined &&\n publication.maxInlineComments !== maxInlineComments\n ) {\n throw new Error(\"pipr.review inlineComments settings must match across review recipes\");\n }\n publication.maxInlineComments = maxInlineComments;\n}\n\nfunction mergePublicationConfig(\n target: RuntimePlan[\"publication\"],\n next: PublicationOptions | undefined,\n): void {\n if (!next) {\n return;\n }\n if (next.maxInlineComments !== undefined) {\n if (\n target.maxInlineComments !== undefined &&\n target.maxInlineComments !== next.maxInlineComments\n ) {\n throw new Error(\"pipr.config publication.maxInlineComments conflicts with existing value\");\n }\n target.maxInlineComments = next.maxInlineComments;\n }\n if (next.autoResolve !== undefined) {\n if (\n target.autoResolve !== undefined &&\n stableJson(target.autoResolve) !== stableJson(next.autoResolve)\n ) {\n throw new Error(\"pipr.config publication.autoResolve conflicts with existing value\");\n }\n target.autoResolve = next.autoResolve;\n }\n}\n\nfunction mergeConfigField<T>(\n name: string,\n current: T | undefined,\n next: T | undefined,\n): T | undefined {\n if (next === undefined) {\n return current;\n }\n if (current !== undefined && stableJson(current) !== stableJson(next)) {\n throw new Error(`pipr.config ${name} conflicts with existing value`);\n }\n return next;\n}\n\nfunction mergeLimits(current: RuntimeLimits | undefined, next: RuntimeLimits | undefined) {\n if (!next) {\n return current;\n }\n assertRuntimeLimitConflicts(current, next);\n return {\n ...current,\n ...next,\n diffManifest:\n (next.diffManifest ?? current?.diffManifest)\n ? { ...current?.diffManifest, ...next.diffManifest }\n : undefined,\n };\n}\n\nfunction assertRuntimeLimitConflicts(\n current: RuntimeLimits | undefined,\n next: RuntimeLimits,\n): void {\n const currentRecord = current as Record<string, unknown> | undefined;\n for (const [key, value] of Object.entries(next)) {\n if (key === \"diffManifest\") {\n continue;\n }\n if (\n value !== undefined &&\n currentRecord?.[key] !== undefined &&\n stableJson(currentRecord[key]) !== stableJson(value)\n ) {\n throw new Error(`pipr.config limits.${key} conflicts with existing value`);\n }\n }\n assertDiffManifestLimitConflicts(current, next);\n}\n\nfunction assertDiffManifestLimitConflicts(\n current: RuntimeLimits | undefined,\n next: RuntimeLimits,\n): void {\n if (current?.diffManifest && next.diffManifest) {\n for (const [key, value] of Object.entries(next.diffManifest)) {\n if (\n value !== undefined &&\n (current.diffManifest as Record<string, unknown>)[key] !== undefined &&\n (current.diffManifest as Record<string, unknown>)[key] !== value\n ) {\n throw new Error(`pipr.config limits.diffManifest.${key} conflicts with existing value`);\n }\n }\n }\n}\n\nfunction createAgent<Input, Output>(\n definition: AgentDefinition<Input, Output>,\n): Agent<Input, Output> {\n return {\n kind: \"pipr.agent\",\n name: definition.name,\n definition,\n extend(patch) {\n return createAgent({\n ...definition,\n ...patch,\n instructions:\n patch.instructions === undefined\n ? definition.instructions\n : {\n kind: \"pipr.prompt\",\n value:\n `${renderPromptValue(definition.instructions)}\\n\\n${renderPromptValue(patch.instructions)}`.trim(),\n },\n });\n },\n };\n}\n\nfunction assertUnique(values: string[], label: string): void {\n const seen = new Set<string>();\n for (const value of values) {\n if (seen.has(value)) {\n throw new Error(`Duplicate ${label} '${value}'`);\n }\n seen.add(value);\n }\n}\n\nfunction assertSupportedCommandRestCapture(pattern: string): void {\n const parts = pattern.match(/\\[[^\\]]+\\]|[^\\s]+/g) ?? [];\n for (const [index, part] of parts.entries()) {\n if (part.startsWith(\"[\") && part.endsWith(\"]\")) {\n const optionalRest = part.slice(1, -1).trim().split(/\\s+/).find(isRestCaptureToken);\n if (optionalRest) {\n throw new Error(finalRequiredRestCaptureMessage(optionalRest));\n }\n continue;\n }\n if (isRestCaptureToken(part) && index !== parts.length - 1) {\n throw new Error(finalRequiredRestCaptureMessage(part));\n }\n }\n}\n\nfunction isRestCaptureToken(value: string): boolean {\n return /^<[a-z0-9-]+\\.\\.\\.>$/.test(value);\n}\n\nfunction finalRequiredRestCaptureMessage(token: string): string {\n return `Rest capture '${token}' must be the final required command pattern token`;\n}\n\nfunction assertModelIdentity(models: ModelProfile[]): void {\n const ids = new Set<string>();\n const effectiveConfigs = new Map<string, string>();\n const providerModels = new Map<string, string>();\n\n for (const model of models) {\n const effectiveConfig = stableJson({\n provider: model.provider,\n model: model.model,\n apiKeyEnv: model.apiKey?.name,\n options: model.options,\n });\n const providerModel = `${model.provider}/${model.model}`;\n\n assertUniqueModelId({ model, providerModel, effectiveConfig, ids, effectiveConfigs });\n ids.add(model.id);\n\n const existingConfigId = effectiveConfigs.get(effectiveConfig);\n if (existingConfigId) {\n throw new Error(\n `Duplicate model config for '${model.id}'. Reuse model '${existingConfigId}' instead.`,\n );\n }\n effectiveConfigs.set(effectiveConfig, model.id);\n\n assertExplicitIdForRepeatedProviderModel(model, providerModel, providerModels);\n providerModels.set(providerModel, model.id);\n }\n}\n\nfunction assertUniqueModelId(options: {\n model: ModelProfile;\n providerModel: string;\n effectiveConfig: string;\n ids: Set<string>;\n effectiveConfigs: Map<string, string>;\n}): void {\n if (!options.ids.has(options.model.id)) {\n return;\n }\n if (options.model.id !== options.providerModel) {\n throw new Error(`Duplicate model id '${options.model.id}'`);\n }\n const existingConfigId = options.effectiveConfigs.get(options.effectiveConfig);\n if (existingConfigId) {\n throw new Error(\n `Duplicate model config for '${options.model.id}'. Reuse model '${existingConfigId}' instead.`,\n );\n }\n throw explicitModelIdError(options.providerModel);\n}\n\nfunction assertExplicitIdForRepeatedProviderModel(\n model: ModelProfile,\n providerModel: string,\n providerModels: Map<string, string>,\n): void {\n const existingProviderModelId = providerModels.get(providerModel);\n if (\n existingProviderModelId &&\n (model.id === providerModel || existingProviderModelId === providerModel)\n ) {\n throw explicitModelIdError(providerModel);\n }\n}\n\nfunction explicitModelIdError(providerModel: string): Error {\n return new Error(\n `Model '${providerModel}' is configured more than once with different options. Add an explicit id.`,\n );\n}\n\nfunction stableJson(value: unknown): string {\n return JSON.stringify(stableJsonValue(value));\n}\n\nfunction stableJsonValue(value: unknown): unknown {\n if (Array.isArray(value)) {\n return value.map(stableJsonValue);\n }\n if (typeof value === \"object\" && value !== null) {\n return Object.fromEntries(\n Object.entries(value as Record<string, unknown>)\n .filter(([, item]) => item !== undefined)\n .toSorted(([left], [right]) => left.localeCompare(right))\n .map(([key, item]) => [key, stableJsonValue(item)]),\n );\n }\n return value;\n}\n"],"mappings":";;;;AAGA,SAAgB,GAAG,SAA+B,GAAG,QAA6B;CAChF,IAAI,OAAO;CACX,KAAK,IAAI,QAAQ,GAAG,QAAQ,QAAQ,QAAQ,SAAS,GAAG;EACtD,QAAQ,QAAQ,UAAU;EAC1B,IAAI,QAAQ,OAAO,QACjB,QAAQ,OAAO,OAAO,UAAU,EAAE;CAEtC;CACA,OAAO,kBAAkB,IAAI,CAAC,CAAC,KAAK;AACtC;;AAGA,SAAgB,kBAAkB,OAAuB;CACvD,MAAM,QAAQ,MAAM,WAAW,KAAM,IAAI,CAAC,CAAC,MAAM,OAAO;CACxD,MAAM,WAAW,MAAM,QAAQ,SAAS,KAAK,KAAK,CAAC,CAAC,SAAS,CAAC;CAC9D,MAAM,SAAS,KAAK,IAAI,GAAG,SAAS,KAAK,SAAS,KAAK,MAAM,KAAK,CAAC,GAAG,EAAE,CAAC,UAAU,CAAC,CAAC;CACrF,OAAO,MAAM,KAAK,SAAS,KAAK,MAAM,MAAM,CAAC,CAAC,CAAC,KAAK,IAAI;AAC1D;;;ACMA,MAAM,uBAAuB,EAAE,OAAO,CAAC,CAAC,IAAI,CAAC;AAC7C,MAAM,wBAAw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,OACA,eACA,gBACM;CACN,MAAM,0BAA0B,eAAe,IAAI,aAAa;CAChE,IACE,4BACC,MAAM,OAAO,iBAAiB,4BAA4B,gBAE3D,MAAM,qBAAqB,aAAa;AAE5C;AAEA,SAAS,qBAAqB,eAA8B;CAC1D,uBAAO,IAAI,MACT,UAAU,cAAc,2EAC1B;AACF;AAEA,SAAS,WAAW,OAAwB;CAC1C,OAAO,KAAK,UAAU,gBAAgB,KAAK,CAAC;AAC9C;AAEA,SAAS,gBAAgB,OAAyB;CAChD,IAAI,MAAM,QAAQ,KAAK,GACrB,OAAO,MAAM,IAAI,eAAe;CAElC,IAAI,OAAO,UAAU,YAAY,UAAU,MACzC,OAAO,OAAO,YACZ,OAAO,QAAQ,KAAgC,CAAC,CAC7C,QAAQ,GAAG,UAAU,SAAS,KAAA,CAAS,CAAC,CACxC,UAAU,CAAC,OAAO,CAAC,WAAW,KAAK,cAAc,KAAK,CAAC,CAAC,CACxD,KAAK,CAAC,KAAK,UAAU,CAAC,KAAK,gBAAgB,IAAI,CAAC,CAAC,CACtD;CAEF,OAAO;AACT"}
|
package/dist/tools.d.mts
DELETED
|
@@ -1,2 +0,0 @@
|
|
|
1
|
-
import { D as JsonObject, G as PromptSource, H as PluginToolDefinition, K as PromptText, M as JsonValue, a as AgentTool, at as SchemaParseResult, d as BuiltinToolCatalog, pt as ToolRunOptions, q as PromptValue, rt as Schema, u as BuiltinSchemaCatalog } from "./index-DMjdjJV4.mjs";
|
|
2
|
-
export type { AgentTool, BuiltinSchemaCatalog, BuiltinToolCatalog, JsonObject, JsonValue, PluginToolDefinition, PromptSource, PromptText, PromptValue, Schema, SchemaParseResult, ToolRunOptions };
|
package/dist/tools.mjs
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
export {};
|