@parcha/agentrun-serve 0.1.0-beta.52 → 0.1.0-beta.54
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 +149 -1
- package/README.md +295 -37
- package/dist/agent-delete.d.ts +5 -6
- package/dist/agent-delete.js +30 -67
- package/dist/agent-package.d.ts +71 -0
- package/dist/agent-package.js +345 -0
- package/dist/agent-rows.d.ts +1 -1
- package/dist/agents-store.d.ts +26 -20
- package/dist/agents-store.js +42 -34
- package/dist/api-only.d.ts +25 -6
- package/dist/api-only.js +34 -13
- package/dist/claude-login.d.ts +1 -0
- package/dist/claude-login.js +1 -1
- package/dist/cli-learning/cli.d.ts +3 -0
- package/dist/cli-learning/cli.js +17 -3
- package/dist/cli-learning/connections.js +3 -2
- package/dist/cli-learning/schema.js +2 -1
- package/dist/cli.js +76 -8
- package/dist/composio-preset.d.ts +3 -1
- package/dist/composio-preset.js +5 -3
- package/dist/composio-triggers.d.ts +4 -0
- package/dist/composio-triggers.js +4 -1
- package/dist/computer-needs.d.ts +32 -0
- package/dist/computer-needs.js +80 -0
- package/dist/computer-setting.d.ts +5 -2
- package/dist/computer-setting.js +8 -1
- package/dist/computers.d.ts +0 -2
- package/dist/computers.js +1 -1
- package/dist/console/assets/index-B_85An2t.js +745 -0
- package/dist/console/assets/index-n1YsbnYh.css +1 -0
- package/dist/console/index.html +2 -2
- package/dist/console-links.d.ts +1 -0
- package/dist/console-links.js +2 -0
- package/dist/env-switch.d.ts +14 -0
- package/dist/env-switch.js +23 -0
- package/dist/errors.d.ts +5 -0
- package/dist/errors.js +10 -0
- package/dist/eval-previous.js +4 -3
- package/dist/fal-price.js +10 -13
- package/dist/github-connection.d.ts +50 -1
- package/dist/github-connection.js +96 -3
- package/dist/github-faux.d.ts +11 -2
- package/dist/github-faux.js +138 -7
- package/dist/github-pull-request.d.ts +37 -0
- package/dist/github-pull-request.js +110 -0
- package/dist/handed-secret.d.ts +4 -0
- package/dist/handed-secret.js +10 -0
- package/dist/harness-archive.d.ts +15 -5
- package/dist/harness-archive.js +71 -34
- package/dist/harness-check.d.ts +2 -1
- package/dist/harness-check.js +36 -95
- package/dist/harness-egress.d.ts +23 -0
- package/dist/harness-egress.js +69 -0
- package/dist/harness-recipe-entry.d.ts +71 -0
- package/dist/harness-recipe-entry.js +184 -0
- package/dist/harness-recipe.d.ts +73 -6
- package/dist/harness-recipe.js +185 -31
- package/dist/harness-sign-in.d.ts +29 -0
- package/dist/harness-sign-in.js +122 -0
- package/dist/harness-table.d.ts +21 -0
- package/dist/harness-table.js +58 -3
- package/dist/harness-zip.d.ts +6 -0
- package/dist/harness-zip.js +203 -0
- package/dist/ids.d.ts +11 -0
- package/dist/ids.js +36 -0
- package/dist/learn/commit.d.ts +14 -1
- package/dist/learn/commit.js +156 -1
- package/dist/learn/compile.js +22 -8
- package/dist/learn/folder.d.ts +5 -0
- package/dist/learn/folder.js +10 -1
- package/dist/learn/learning.sh +15 -3
- package/dist/learn/promote.d.ts +2 -2
- package/dist/learn/secrets.js +30 -7
- package/dist/learning-routes.d.ts +23 -11
- package/dist/learning-routes.js +110 -20
- package/dist/learning.d.ts +9 -6
- package/dist/learning.js +9 -4
- package/dist/live-reach.d.ts +34 -7
- package/dist/live-reach.js +76 -11
- package/dist/mcp-gateway.js +15 -2
- package/dist/mcp-probe.d.ts +3 -0
- package/dist/mcp-probe.js +8 -3
- package/dist/mcp-resources.d.ts +44 -0
- package/dist/mcp-resources.js +100 -0
- package/dist/mcp-servers-store.d.ts +16 -12
- package/dist/model.d.ts +4 -4
- package/dist/model.js +6 -6
- package/dist/native/cli.js +9 -2
- package/dist/native/connection.d.ts +2 -2
- package/dist/native/connection.js +5 -2
- package/dist/native/discovery.d.ts +2 -0
- package/dist/native/discovery.js +10 -6
- package/dist/native/remote-worker-bridge.js +36 -4
- package/dist/native/remote.d.ts +18 -1
- package/dist/native/remote.js +126 -37
- package/dist/native/schema.d.ts +6 -0
- package/dist/native/schema.js +31 -6
- package/dist/native/source-account.d.ts +13 -0
- package/dist/native/source-account.js +114 -0
- package/dist/native/source-capture-hooks.d.ts +5 -0
- package/dist/native/source-capture-hooks.js +102 -0
- package/dist/native/source-mcp-selection.d.ts +13 -0
- package/dist/native/source-mcp-selection.js +72 -0
- package/dist/native/source-runtime-tools.d.ts +19 -0
- package/dist/native/source-runtime-tools.js +103 -0
- package/dist/native/source-snapshot-types.d.ts +138 -0
- package/dist/native/source-snapshot-types.js +12 -0
- package/dist/native/source-snapshot.d.ts +8 -0
- package/dist/native/source-snapshot.js +1201 -0
- package/dist/observation/learning.js +3 -2
- package/dist/openapi.js +275 -40
- package/dist/print.js +1 -1
- package/dist/purged-workflow.d.ts +12 -0
- package/dist/purged-workflow.js +43 -0
- package/dist/run-keys.d.ts +46 -0
- package/dist/run-keys.js +109 -0
- package/dist/run-launch.d.ts +16 -1
- package/dist/run-launch.js +30 -1
- package/dist/run-learning-served.d.ts +2 -2
- package/dist/run-model-key.d.ts +2 -2
- package/dist/run-model-key.js +5 -5
- package/dist/run-secrets.d.ts +2 -0
- package/dist/run-secrets.js +7 -4
- package/dist/run-view.d.ts +17 -0
- package/dist/run-view.js +25 -1
- package/dist/runner/adapter-loop.d.ts +11 -3
- package/dist/runner/adapter-loop.js +138 -22
- package/dist/runner/adapter-run-spec.js +26 -13
- package/dist/runner/audit.d.ts +2 -0
- package/dist/runner/audit.js +9 -1
- package/dist/runner/beside.js +2 -1
- package/dist/runner/claim-secrets.d.ts +29 -3
- package/dist/runner/claim-secrets.js +38 -4
- package/dist/runner/cli-run-spec.js +24 -13
- package/dist/runner/harness-loops.d.ts +6 -0
- package/dist/runner/harness-loops.js +11 -1
- package/dist/runner/held.d.ts +4 -0
- package/dist/runner/journal-kinds.d.ts +2 -0
- package/dist/runner/learned-first.d.ts +2 -0
- package/dist/runner/learned-first.js +1 -1
- package/dist/runner/learning-end.d.ts +7 -2
- package/dist/runner/learning-end.js +22 -10
- package/dist/runner/learning-seed.d.ts +9 -3
- package/dist/runner/learning-seed.js +2 -2
- package/dist/runner/main.d.ts +1 -0
- package/dist/runner/main.js +20 -13
- package/dist/runner/mcp-claim.js +6 -1
- package/dist/runner/mcp-run.d.ts +10 -7
- package/dist/runner/mcp-run.js +3 -5
- package/dist/runner/metrics.d.ts +4 -2
- package/dist/runner/metrics.js +15 -3
- package/dist/runner/monid-run.js +9 -11
- package/dist/runner/pr-checkout.d.ts +21 -4
- package/dist/runner/pr-checkout.js +103 -4
- package/dist/runner/project-checkpoint.d.ts +35 -0
- package/dist/runner/project-checkpoint.js +116 -0
- package/dist/runner/project-drain.d.ts +8 -0
- package/dist/runner/project-drain.js +25 -0
- package/dist/runner/project-host.d.ts +10 -0
- package/dist/runner/project-host.js +52 -0
- package/dist/runner/promotion.d.ts +14 -6
- package/dist/runner/promotion.js +98 -41
- package/dist/runner/redact.d.ts +13 -0
- package/dist/runner/redact.js +67 -1
- package/dist/runner/run-channel.d.ts +9 -0
- package/dist/runner/run-channel.js +15 -2
- package/dist/runner/run-child-host.d.ts +8 -4
- package/dist/runner/run-child-host.js +178 -45
- package/dist/runner/run-errors.js +2 -2
- package/dist/runner/runner-check.d.ts +3 -0
- package/dist/runner/runner-check.js +28 -2
- package/dist/runner/runner.js +26 -9
- package/dist/runner/store-secrets.js +7 -3
- package/dist/runner/workflow-first.d.ts +4 -0
- package/dist/runner/workflow-first.js +13 -0
- package/dist/runner/workflow-loop.d.ts +2 -1
- package/dist/runner/workflow-loop.js +2 -1
- package/dist/runner/workflow-spec.js +1 -1
- package/dist/runs-over-store.d.ts +34 -6
- package/dist/runs-over-store.js +133 -25
- package/dist/sdk/runs.d.ts +11 -1
- package/dist/sdk/runs.js +117 -26
- package/dist/sdk/schema.js +12 -2
- package/dist/sdk/workflows.d.ts +1 -1
- package/dist/server.d.ts +79 -32
- package/dist/server.js +673 -113
- package/dist/skills/agentrun-serve/SKILL.md +2 -1
- package/dist/source-sync/adoption.d.ts +15 -0
- package/dist/source-sync/adoption.js +36 -0
- package/dist/source-sync/auxiliary.d.ts +23 -0
- package/dist/source-sync/auxiliary.js +64 -0
- package/dist/source-sync/capture-git.d.ts +5 -0
- package/dist/source-sync/capture-git.js +272 -0
- package/dist/source-sync/capture-project.d.ts +53 -0
- package/dist/source-sync/capture-project.js +206 -0
- package/dist/source-sync/capture-refusal.d.ts +7 -0
- package/dist/source-sync/capture-refusal.js +16 -0
- package/dist/source-sync/capture.d.ts +11 -0
- package/dist/source-sync/capture.js +22 -0
- package/dist/source-sync/checkpoint-gate.d.ts +21 -0
- package/dist/source-sync/checkpoint-gate.js +52 -0
- package/dist/source-sync/checkpoints.d.ts +66 -0
- package/dist/source-sync/checkpoints.js +168 -0
- package/dist/source-sync/claim.d.ts +11 -0
- package/dist/source-sync/claim.js +48 -0
- package/dist/source-sync/destination.d.ts +47 -0
- package/dist/source-sync/destination.js +239 -0
- package/dist/source-sync/io.d.ts +15 -0
- package/dist/source-sync/io.js +52 -0
- package/dist/source-sync/local.d.ts +43 -0
- package/dist/source-sync/local.js +229 -0
- package/dist/source-sync/prepare.d.ts +59 -0
- package/dist/source-sync/prepare.js +93 -0
- package/dist/source-sync/projects.d.ts +61 -0
- package/dist/source-sync/projects.js +130 -0
- package/dist/source-sync/registry.d.ts +95 -0
- package/dist/source-sync/registry.js +226 -0
- package/dist/source-sync/service.d.ts +33 -0
- package/dist/source-sync/service.js +118 -0
- package/dist/source-sync/skill-edits.d.ts +12 -0
- package/dist/source-sync/skill-edits.js +122 -0
- package/dist/source-sync/snapshots.d.ts +48 -0
- package/dist/source-sync/snapshots.js +448 -0
- package/dist/source-sync/types.d.ts +9 -0
- package/dist/source-sync/types.js +14 -0
- package/dist/source-sync/workspace.d.ts +66 -0
- package/dist/source-sync/workspace.js +273 -0
- package/dist/store/agent-body.d.ts +6 -2
- package/dist/store/agent-body.js +18 -7
- package/dist/store/index.d.ts +2 -2
- package/dist/store/index.js +1 -1
- package/dist/store/schema.d.ts +2 -1
- package/dist/store/schema.js +2 -1
- package/dist/store/seal.d.ts +5 -1
- package/dist/store/seal.js +12 -3
- package/dist/store/sqlite/project-checkpoints.d.ts +11 -0
- package/dist/store/sqlite/project-checkpoints.js +70 -0
- package/dist/store/sqlite/run-launch.d.ts +4 -12
- package/dist/store/sqlite/run-launch.js +5 -19
- package/dist/store/sqlite/store.js +224 -170
- package/dist/store/store.d.ts +116 -39
- package/dist/store/store.js +14 -1
- package/dist/store-reads/learning.d.ts +2 -2
- package/dist/store-view.d.ts +3 -1
- package/dist/store-view.js +17 -5
- package/dist/suggestions.d.ts +282 -0
- package/dist/suggestions.js +919 -0
- package/dist/telemetry.d.ts +8 -1
- package/dist/telemetry.js +12 -4
- package/dist/template-import.d.ts +27 -2
- package/dist/template-import.js +148 -13
- package/dist/templates.d.ts +103 -77
- package/dist/templates.js +71 -17
- package/dist/timeline/index.d.ts +1 -1
- package/dist/timeline/index.js +1 -1
- package/dist/timeline/timeline.d.ts +5 -0
- package/dist/timeline/timeline.js +8 -0
- package/dist/tool-plane.d.ts +12 -12
- package/dist/tools.d.ts +8 -8
- package/dist/trigger-launch-hook.d.ts +49 -0
- package/dist/trigger-launch-hook.js +91 -0
- package/dist/trigger-targets.d.ts +14 -1
- package/dist/trigger-targets.js +20 -0
- package/dist/triggers.d.ts +54 -5
- package/dist/triggers.js +143 -8
- package/dist/uploads-archil.js +1 -1
- package/dist/uploads.js +1 -1
- package/dist/validate.d.ts +1 -1
- package/dist/validate.js +3 -4
- package/dist/workspace/computer-for-claim.d.ts +2 -0
- package/dist/workspace/computer-for-claim.js +43 -0
- package/dist/workspace/paths.d.ts +6 -0
- package/dist/workspace/paths.js +6 -0
- package/dist/workspace/resolve-computer.d.ts +1 -0
- package/dist/workspace/run-tools.d.ts +2 -0
- package/dist/workspace/run-tools.js +8 -0
- package/dist/workspace/synced-folder.d.ts +1 -1
- package/dist/workspace/synced-folder.js +11 -14
- package/launcher/agentrun-serve +1 -1
- package/package.json +10 -10
- package/skills/agentrun-serve/SKILL.md +2 -1
- package/templates/README.md +8 -4
- package/templates/agent-scout/agent.md +46 -0
- package/templates/agent-scout/skills/scout/SKILL.md +88 -0
- package/templates/agent-scout/skills/scout/suggestions.schema.json +112 -0
- package/dist/console/assets/index-B-D0EM3j.js +0 -733
- package/dist/console/assets/index-DlQepP2J.css +0 -1
|
@@ -0,0 +1,282 @@
|
|
|
1
|
+
import { type InputIssue } from "./errors.js";
|
|
2
|
+
import type { GitHubConnectionView, RepoInstallation } from "./github-connection.js";
|
|
3
|
+
import { type NewFile } from "./github-pull-request.js";
|
|
4
|
+
import type { Settings } from "./store/index.js";
|
|
5
|
+
import type { UsageEventName } from "./telemetry.js";
|
|
6
|
+
import { type Json } from "./validate.js";
|
|
7
|
+
/** The bundled template a scan runs. */
|
|
8
|
+
export declare const SCOUT_TEMPLATE = "agent-scout";
|
|
9
|
+
/** Where in the repository a created agent's package goes: `<dir>/<key>/agent.md`. */
|
|
10
|
+
export declare const PACKAGE_DIR = ".agentrun/agents";
|
|
11
|
+
/** What the token a pull request is made with holds, and no more: one repository, these permissions. */
|
|
12
|
+
export declare const PULL_PERMISSIONS: {
|
|
13
|
+
readonly contents: "write";
|
|
14
|
+
readonly pull_requests: "write";
|
|
15
|
+
readonly metadata: "read";
|
|
16
|
+
};
|
|
17
|
+
/** A create's claim on its suggestion, kept on its row in the shared store: one older than this was left by a server
|
|
18
|
+
* that stopped mid-create, and the next create takes it over. A create's GitHub calls and apply take seconds. */
|
|
19
|
+
export declare const CREATE_CLAIM_MS: number;
|
|
20
|
+
/** A scan's start, kept on its repository's row while its run is started: one older than this was left by a server that
|
|
21
|
+
* stopped mid-start, and the next scan takes it over. */
|
|
22
|
+
export declare const SCAN_CLAIM_MS: number;
|
|
23
|
+
declare const INPUT_TYPES: readonly ["string", "number", "integer", "boolean"];
|
|
24
|
+
declare const OUTPUT_TYPES: readonly ["string", "number", "integer", "boolean", "string_list"];
|
|
25
|
+
declare const LANGUAGES: {
|
|
26
|
+
readonly typescript: readonly [".ts", ".mts", ".cts"];
|
|
27
|
+
readonly javascript: readonly [".mjs", ".cjs"];
|
|
28
|
+
readonly python: readonly [".py"];
|
|
29
|
+
readonly other: readonly [".md"];
|
|
30
|
+
};
|
|
31
|
+
declare const TIERS: readonly ["fast", "balanced", "strong"];
|
|
32
|
+
declare const IMPACTS: readonly ["high", "medium", "low"];
|
|
33
|
+
export type Language = keyof typeof LANGUAGES;
|
|
34
|
+
export type InputField = {
|
|
35
|
+
name: string;
|
|
36
|
+
type: (typeof INPUT_TYPES)[number];
|
|
37
|
+
description: string;
|
|
38
|
+
required: boolean;
|
|
39
|
+
};
|
|
40
|
+
export type OutputField = {
|
|
41
|
+
name: string;
|
|
42
|
+
type: (typeof OUTPUT_TYPES)[number];
|
|
43
|
+
description: string;
|
|
44
|
+
enum?: string[];
|
|
45
|
+
};
|
|
46
|
+
export type Line = {
|
|
47
|
+
path: string;
|
|
48
|
+
line: number;
|
|
49
|
+
quote: string;
|
|
50
|
+
};
|
|
51
|
+
/** One suggestion, as checked here from the scout's answer. */
|
|
52
|
+
export type Suggestion = {
|
|
53
|
+
key: string;
|
|
54
|
+
title: string;
|
|
55
|
+
summary: string;
|
|
56
|
+
why: string;
|
|
57
|
+
impact: (typeof IMPACTS)[number];
|
|
58
|
+
evidence: Line[];
|
|
59
|
+
agent: {
|
|
60
|
+
name: string;
|
|
61
|
+
description: string;
|
|
62
|
+
instructions: string;
|
|
63
|
+
inputs: InputField[];
|
|
64
|
+
output: OutputField[];
|
|
65
|
+
tools: string[];
|
|
66
|
+
tier: (typeof TIERS)[number];
|
|
67
|
+
};
|
|
68
|
+
integration: {
|
|
69
|
+
language: Language;
|
|
70
|
+
path: string;
|
|
71
|
+
call_site: {
|
|
72
|
+
path: string;
|
|
73
|
+
line: number;
|
|
74
|
+
note: string;
|
|
75
|
+
};
|
|
76
|
+
};
|
|
77
|
+
};
|
|
78
|
+
export type Status = "open" | "discarded" | "created";
|
|
79
|
+
/** A suggestion as it is kept: what the scan found, where, and what a person decided. */
|
|
80
|
+
export type Item = {
|
|
81
|
+
id: string;
|
|
82
|
+
repo: string;
|
|
83
|
+
key: string;
|
|
84
|
+
status: Status;
|
|
85
|
+
suggestion: Suggestion;
|
|
86
|
+
scan: {
|
|
87
|
+
run_id: string;
|
|
88
|
+
commit: string;
|
|
89
|
+
at: number;
|
|
90
|
+
};
|
|
91
|
+
decided_at?: number;
|
|
92
|
+
created?: {
|
|
93
|
+
agent_id: string;
|
|
94
|
+
template_id: string;
|
|
95
|
+
branch?: string;
|
|
96
|
+
commit?: string;
|
|
97
|
+
pull_request?: {
|
|
98
|
+
number: number;
|
|
99
|
+
url: string;
|
|
100
|
+
};
|
|
101
|
+
pull_error?: string;
|
|
102
|
+
};
|
|
103
|
+
/** A create in flight, on any server sharing the store: `by` is that create's own id. Taken off when it ends. */
|
|
104
|
+
creating?: Claim;
|
|
105
|
+
/** The branch a create pushed, kept before it makes the agent: a create after a failed write finds the agent made
|
|
106
|
+
* from that template at that commit and reuses it, or deletes the branch when none was made. */
|
|
107
|
+
pushed?: {
|
|
108
|
+
branch: string;
|
|
109
|
+
commit: string;
|
|
110
|
+
template_id: string;
|
|
111
|
+
base: string;
|
|
112
|
+
};
|
|
113
|
+
};
|
|
114
|
+
/** A claim on a row in the shared store: when it was taken, and by which request (a random id of its own). */
|
|
115
|
+
export type Claim = {
|
|
116
|
+
at: number;
|
|
117
|
+
by: string;
|
|
118
|
+
};
|
|
119
|
+
/** A scan as it is kept: its run, and what was read of it once it ended. */
|
|
120
|
+
export type Scan = {
|
|
121
|
+
repo: string;
|
|
122
|
+
run_id: string;
|
|
123
|
+
agent_id: string;
|
|
124
|
+
started_at: number;
|
|
125
|
+
read?: {
|
|
126
|
+
status: "completed" | "failed" | "cancelled";
|
|
127
|
+
at: number;
|
|
128
|
+
app?: string;
|
|
129
|
+
commit?: string;
|
|
130
|
+
found: number;
|
|
131
|
+
dropped: string[];
|
|
132
|
+
skipped: number;
|
|
133
|
+
error?: string;
|
|
134
|
+
};
|
|
135
|
+
/** A new scan of the repository being started, on any server sharing the store; the row is that scan's once it has. */
|
|
136
|
+
starting?: Claim;
|
|
137
|
+
/** A reader writing this scan's suggestions, on any server sharing the store; taken off when it marks the scan read. */
|
|
138
|
+
settling?: Claim;
|
|
139
|
+
};
|
|
140
|
+
/** A run of the scout, as its view says. */
|
|
141
|
+
export type ScanRun = {
|
|
142
|
+
status: string;
|
|
143
|
+
output?: unknown;
|
|
144
|
+
error?: string;
|
|
145
|
+
endedAt?: number;
|
|
146
|
+
};
|
|
147
|
+
export type SuggestionsDeps = {
|
|
148
|
+
readonly settings: Pick<Settings, "get" | "put" | "putIfAbsent" | "replaceIf" | "removeIf" | "all">;
|
|
149
|
+
readonly github: {
|
|
150
|
+
view(): GitHubConnectionView | undefined;
|
|
151
|
+
settingsUrl(): string | undefined;
|
|
152
|
+
readonly api: string;
|
|
153
|
+
repoInstallation(repo: string, signal?: AbortSignal): Promise<RepoInstallation | {
|
|
154
|
+
unusable: string;
|
|
155
|
+
reason: "not_connected" | "not_installed" | "github_failed";
|
|
156
|
+
}>;
|
|
157
|
+
tokenWith(id: number, repo: string, permissions: Record<string, "read" | "write">, signal?: AbortSignal): Promise<{
|
|
158
|
+
token: string;
|
|
159
|
+
expiresAt: number;
|
|
160
|
+
} | {
|
|
161
|
+
unusable: string;
|
|
162
|
+
}>;
|
|
163
|
+
revokeToken(token: string): Promise<void>;
|
|
164
|
+
};
|
|
165
|
+
/** The scout agent's id: one agent-scout made here and not archived, else a new one applied from the bundled package. */
|
|
166
|
+
scoutAgent(): Promise<string>;
|
|
167
|
+
/** A run of the scout agent started with `content`: its id. */
|
|
168
|
+
startScan(agentId: string, content: string): Promise<string>;
|
|
169
|
+
/** A run's state; undefined when there is no such run. */
|
|
170
|
+
readRun(runId: string): Promise<ScanRun | undefined>;
|
|
171
|
+
/** A scan's run cancelled: one that started but whose scan could not be kept, so nothing would ever read it. */
|
|
172
|
+
cancelScan(runId: string): Promise<void>;
|
|
173
|
+
/** The package (its files, under the id and origin given) made into an agent here: applied, then kept beside the other
|
|
174
|
+
* imported templates. Throws what the apply refuses (a missing model key, say), with nothing made. */
|
|
175
|
+
makeAgent(id: string, origin: {
|
|
176
|
+
source: string;
|
|
177
|
+
sha: string;
|
|
178
|
+
publisher: string;
|
|
179
|
+
}, files: ReadonlyMap<string, Buffer>): Promise<{
|
|
180
|
+
agentId: string;
|
|
181
|
+
warnings: InputIssue[];
|
|
182
|
+
}>;
|
|
183
|
+
/** The agent made here from the imported template `id` at commit `sha`, not archived; undefined when there is none. */
|
|
184
|
+
agentFrom(id: string, sha: string): Promise<string | undefined>;
|
|
185
|
+
/** This server's public URL, which the pull request names as AGENTRUN_URL. */
|
|
186
|
+
readonly publicUrl?: string;
|
|
187
|
+
/** Told each time a scan starts, a suggestion is discarded and a suggested agent's pull request opens: the anonymous
|
|
188
|
+
* counts' `used` (telemetry.ts), which hears the event's name and nothing else. It never fails the request. */
|
|
189
|
+
readonly used?: (event: UsageEventName) => void;
|
|
190
|
+
readonly now?: () => number;
|
|
191
|
+
};
|
|
192
|
+
/** A suggestion's id: the same repository and key always give the same one, so a decision outlives every rescan. */
|
|
193
|
+
export declare const suggestionId: (repo: string, key: string) => string;
|
|
194
|
+
/** A path in a repository: relative, in forward slashes, with no `.` or `..` part, at most 300, and no character that
|
|
195
|
+
* ends a line in any language a client is written in: no control character (C0 or C1), no U+2028 or U+2029. */
|
|
196
|
+
export declare function repoPath(value: unknown): string | undefined;
|
|
197
|
+
/** One suggestion of the scout's answer, checked whole; or why it is dropped. */
|
|
198
|
+
export declare function checkSuggestion(raw: unknown): Suggestion | string;
|
|
199
|
+
/** The scout's answer read: what the app is, the commit it read, its suggestions that check (at most five, keys
|
|
200
|
+
* distinct), and why each other one was dropped; or why the answer itself is not one. */
|
|
201
|
+
export declare function readScoutAnswer(output: unknown, repo: string): {
|
|
202
|
+
app: string;
|
|
203
|
+
commit: string;
|
|
204
|
+
suggestions: Suggestion[];
|
|
205
|
+
dropped: string[];
|
|
206
|
+
} | {
|
|
207
|
+
invalid: string;
|
|
208
|
+
};
|
|
209
|
+
/** The environment variable that names a created agent's id in the app. */
|
|
210
|
+
export declare const agentVariable: (key: string) => string;
|
|
211
|
+
/** The answer's JSON Schema, from its fields. */
|
|
212
|
+
export declare function outputSchema(s: Suggestion): Json;
|
|
213
|
+
/** The agent's template package, as files from the package's own folder: agent.md and output.schema.json. */
|
|
214
|
+
export declare function packageFiles(s: Suggestion, name?: string): Map<string, Buffer>;
|
|
215
|
+
/** Whether the package checks as the server checks a bundled or imported one: its problems, or none. */
|
|
216
|
+
export declare function packageProblems(s: Suggestion, name?: string): string[];
|
|
217
|
+
/** The client a created agent's pull request adds, in the call site's language: no dependency, fetch or urllib alone. */
|
|
218
|
+
export declare function clientFile(s: Suggestion, repo: string, commit: string): NewFile;
|
|
219
|
+
/** The pull request's title and body. */
|
|
220
|
+
export declare function pullText(s: Suggestion, at: {
|
|
221
|
+
repo: string;
|
|
222
|
+
commit: string;
|
|
223
|
+
agentId: string;
|
|
224
|
+
publicUrl?: string;
|
|
225
|
+
}): {
|
|
226
|
+
title: string;
|
|
227
|
+
body: string;
|
|
228
|
+
};
|
|
229
|
+
/** The repository a body or query names, as owner/name; 422 under `field` for anything else. */
|
|
230
|
+
export declare function repoOf(value: unknown, field?: string): string;
|
|
231
|
+
/** Why a repository's installation can't open a pull request: the permissions it lacks, and where to grant them. */
|
|
232
|
+
export declare function missingPermissions(installation: RepoInstallation): string[];
|
|
233
|
+
export declare class Suggestions {
|
|
234
|
+
private readonly deps;
|
|
235
|
+
constructor(deps: SuggestionsDeps);
|
|
236
|
+
private now;
|
|
237
|
+
/** Whether a claim is held: taken, and not so old that the server holding it must have stopped. */
|
|
238
|
+
private held;
|
|
239
|
+
/** The anonymous counts told what was done: a hook that throws is the counts' problem, never the request's. */
|
|
240
|
+
private used;
|
|
241
|
+
private item;
|
|
242
|
+
private need;
|
|
243
|
+
/** `item` written over the one read as `was`: false when another write moved it first. */
|
|
244
|
+
private write;
|
|
245
|
+
/** Each scan as kept. */
|
|
246
|
+
private scans;
|
|
247
|
+
private items;
|
|
248
|
+
/** A scan's run read once it ended: its suggestions kept (a decided one left as it was decided, an open one of an
|
|
249
|
+
* older scan replaced, one the new answer no longer holds removed), and what was read kept on the scan. */
|
|
250
|
+
private settle;
|
|
251
|
+
private mark;
|
|
252
|
+
/** GET /v2/suggestions: GitHub's state, each scan, and the suggestions (`status`: open and created by default). */
|
|
253
|
+
list(query: {
|
|
254
|
+
repo?: string;
|
|
255
|
+
status?: string;
|
|
256
|
+
}): Promise<Json>;
|
|
257
|
+
/** POST /v2/suggestions/scans: a scan of `repo` started (or the one still running answered). */
|
|
258
|
+
scan(body: Json): Promise<{
|
|
259
|
+
status: 200 | 202;
|
|
260
|
+
body: Json;
|
|
261
|
+
}>;
|
|
262
|
+
/** GET /v2/suggestions/{id}: the suggestion whole, the files a create would add (rendered now), and whether this
|
|
263
|
+
* server's GitHub App can open its pull request (read from GitHub now), with what to do when it can't. */
|
|
264
|
+
get(id: string, signal?: AbortSignal, name?: string): Promise<Json>;
|
|
265
|
+
/** Whether a pull request can be opened on `repo` now, and if not, why and where to fix it. */
|
|
266
|
+
private readiness;
|
|
267
|
+
/** POST /v2/suggestions/{id}/discard: it goes away, and later scans are told not to suggest it again. */
|
|
268
|
+
discard(id: string): Promise<Json>;
|
|
269
|
+
/** POST /v2/suggestions/{id}/restore: a discarded suggestion back among the open ones (an undo). */
|
|
270
|
+
restore(id: string): Promise<Json>;
|
|
271
|
+
private decide;
|
|
272
|
+
/** POST /v2/suggestions/{id}/create: the agent made here and its pull request opened (or what is missing to). A
|
|
273
|
+
* suggestion created already answers as it is; one whose agent was made but whose pull request failed opens only that. */
|
|
274
|
+
create(id: string, body: Json, signal?: AbortSignal): Promise<{
|
|
275
|
+
status: 200 | 201;
|
|
276
|
+
body: Json;
|
|
277
|
+
}>;
|
|
278
|
+
/** A create's claim taken off its suggestion's row, whatever the create wrote there; never another create's. */
|
|
279
|
+
private release;
|
|
280
|
+
private creating;
|
|
281
|
+
}
|
|
282
|
+
export {};
|