superagent-skill 0.4.0 → 0.4.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 +9 -0
- package/lib/cli.mjs +104 -3
- package/lib/index.mjs +1 -1
- package/lib/{settings-D8KZBXO7.mjs → settings-Dud0f9wo.mjs} +6 -208
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -138,3 +138,12 @@ is what a cron entry calls each minute.
|
|
|
138
138
|
pnpm check # typecheck, unit tests, build
|
|
139
139
|
SUPERAGENT_LIVE=1 SUPERAGENT_AGENT=codex pnpm test # also runs a real agent end to end
|
|
140
140
|
```
|
|
141
|
+
|
|
142
|
+
## Lessons
|
|
143
|
+
|
|
144
|
+
[`LESSONS.md`](LESSONS.md) keeps what already cost a second pass here — a
|
|
145
|
+
setting shipped but read nowhere, a note written after the worker that needed
|
|
146
|
+
it started, a doc line that claimed a test nobody ran — as rules with the
|
|
147
|
+
commit or test that taught them. Read it before changing code; every task ends
|
|
148
|
+
by adding a lesson, raising one's `Seen` count, or saying why it taught
|
|
149
|
+
nothing.
|
package/lib/cli.mjs
CHANGED
|
@@ -1,11 +1,108 @@
|
|
|
1
|
-
import { C as
|
|
1
|
+
import { C as reasonText, D as key, L as runningAssignment, N as latestReport, a as readSettings, b as directionAllowed, c as AGENT_NAMES, g as readState, h as FileRepositories, l as installed, m as runProcess, o as stringifyYaml, p as reportInstructions, r as defaultSettings, s as writeSettings, t as SETTINGS_FILE, u as runnerFor, v as RuleAssessmentSchema, x as Engine, z as threadKey } from "./settings-Dud0f9wo.mjs";
|
|
2
2
|
import { createHash } from "node:crypto";
|
|
3
3
|
import { z } from "zod";
|
|
4
|
-
import { access, appendFile, mkdir, readFile, readdir, rm, stat, writeFile } from "node:fs/promises";
|
|
5
|
-
import { dirname, join, resolve } from "node:path";
|
|
4
|
+
import { access, appendFile, lstat, mkdir, readFile, readdir, rename, rm, stat, unlink, writeFile } from "node:fs/promises";
|
|
5
|
+
import { delimiter, dirname, join, resolve } from "node:path";
|
|
6
6
|
import { execFile, spawn } from "node:child_process";
|
|
7
7
|
import { homedir } from "node:os";
|
|
8
8
|
import { fileURLToPath } from "node:url";
|
|
9
|
+
// src/infra/environment.ts
|
|
10
|
+
/**
|
|
11
|
+
* Writes the CLI shims and the isolated git configuration that bind a run to the agent's accounts.
|
|
12
|
+
*
|
|
13
|
+
* Each shim strips its own directory from PATH before it execs, so a wrapper script that resolves `gh` by name reaches the
|
|
14
|
+
* real binary instead of looping. The git configuration replaces the operator's global configuration for the run, so a
|
|
15
|
+
* worker cannot push with the operator's credentials.
|
|
16
|
+
*
|
|
17
|
+
* These are guardrails, not an OS boundary: a run shares the operator's OS user and can read their home directory.
|
|
18
|
+
*/
|
|
19
|
+
const MARKER = "# Written by superagent on every start; edits are lost.";
|
|
20
|
+
/** Commands the shims provide, which a blocked list must never shadow. */
|
|
21
|
+
const WORKER_COMMANDS = [
|
|
22
|
+
"gh",
|
|
23
|
+
"git",
|
|
24
|
+
"lark-cli"
|
|
25
|
+
];
|
|
26
|
+
const workerBin = (stateDir) => join(stateDir, "worker-bin");
|
|
27
|
+
const workerGitConfig = (stateDir) => join(stateDir, "worker-gitconfig");
|
|
28
|
+
const shellQuote = (value) => `'${value.replaceAll("'", "'\\''")}'`;
|
|
29
|
+
const gitQuote = (value) => `"${value.replace(/[\\"]/g, (char) => `\\${char}`)}"`;
|
|
30
|
+
const credentialHelper = (cli) => `!${shellQuote(cli)} auth git-credential`;
|
|
31
|
+
async function written(file) {
|
|
32
|
+
try {
|
|
33
|
+
const stat = await lstat(file);
|
|
34
|
+
if (!stat.isFile() || stat.size > 4096) return false;
|
|
35
|
+
return (await readFile(file, "utf8")).includes(MARKER);
|
|
36
|
+
} catch {
|
|
37
|
+
return false;
|
|
38
|
+
}
|
|
39
|
+
}
|
|
40
|
+
async function own(file, content) {
|
|
41
|
+
const temporary = `${file}.${process.pid}.tmp`;
|
|
42
|
+
await writeFile(temporary, content, { mode: 384 });
|
|
43
|
+
await rename(temporary, file);
|
|
44
|
+
}
|
|
45
|
+
/**
|
|
46
|
+
* Writes the shims and git configuration, refusing to overwrite files it did not write.
|
|
47
|
+
* @throws when a file in the shim directory or at the git configuration path was written by something else.
|
|
48
|
+
*/
|
|
49
|
+
async function writeEnvironment(accounts, blockedCommands) {
|
|
50
|
+
const dir = workerBin(accounts.stateDir);
|
|
51
|
+
await mkdir(dir, { recursive: true });
|
|
52
|
+
const before = await readdir(dir);
|
|
53
|
+
for (const name of before) if (!await written(join(dir, name))) throw new Error(`The file ${join(dir, name)} was not written by superagent; move it away or choose another state directory.`);
|
|
54
|
+
const kept = /* @__PURE__ */ new Set();
|
|
55
|
+
const shim = async (name, body) => {
|
|
56
|
+
const temporary = join(dir, `.${name}.${process.pid}.tmp`);
|
|
57
|
+
await writeFile(temporary, `#!/bin/sh\n${MARKER}\n${body}\n`, { mode: 493 });
|
|
58
|
+
await rename(temporary, join(dir, name));
|
|
59
|
+
kept.add(name);
|
|
60
|
+
};
|
|
61
|
+
const withoutShims = [
|
|
62
|
+
`self=${shellQuote(dir)}`,
|
|
63
|
+
"rest=",
|
|
64
|
+
"IFS=:",
|
|
65
|
+
"set -f",
|
|
66
|
+
"for entry in $PATH; do [ \"$entry\" = \"$self\" ] || rest=\"${rest:+$rest:}$entry\"; done",
|
|
67
|
+
"set +f",
|
|
68
|
+
"unset IFS",
|
|
69
|
+
"PATH=$rest",
|
|
70
|
+
"export PATH"
|
|
71
|
+
].join("\n");
|
|
72
|
+
const run = (program) => `${withoutShims}\nexec ${shellQuote(program)} "$@"`;
|
|
73
|
+
const fail = (message) => `echo ${shellQuote(message)} >&2\nexit 1`;
|
|
74
|
+
await shim("gh", run(accounts.githubCli));
|
|
75
|
+
await shim("lark-cli", accounts.feishuCli ? run(accounts.feishuCli) : fail("lark-cli is unavailable: this installation has no Feishu bot."));
|
|
76
|
+
for (const name of new Set(blockedCommands.filter((name) => !WORKER_COMMANDS.includes(name)))) await shim(name, fail(`${name} is blocked in this installation; use gh, which acts as ${accounts.agentLogin}.`));
|
|
77
|
+
for (const name of before) if (!kept.has(name)) await unlink(join(dir, name));
|
|
78
|
+
await own(workerGitConfig(accounts.stateDir), [
|
|
79
|
+
MARKER,
|
|
80
|
+
"[user]",
|
|
81
|
+
" useConfigOnly = true",
|
|
82
|
+
"[credential]",
|
|
83
|
+
" helper =",
|
|
84
|
+
"[credential \"https://github.com\"]",
|
|
85
|
+
`\thelper = ${gitQuote(credentialHelper(accounts.githubCli))}`,
|
|
86
|
+
"[url \"https://github.com/\"]",
|
|
87
|
+
" insteadOf = git@github.com:",
|
|
88
|
+
" insteadOf = ssh://git@github.com:",
|
|
89
|
+
"[filter \"lfs\"]",
|
|
90
|
+
" clean = git-lfs clean -- %f",
|
|
91
|
+
" smudge = git-lfs smudge -- %f",
|
|
92
|
+
" process = git-lfs filter-process",
|
|
93
|
+
" required = true"
|
|
94
|
+
].join("\n") + "\n");
|
|
95
|
+
}
|
|
96
|
+
/** Environment variables a run receives, with the shim directory first on PATH. */
|
|
97
|
+
function runEnvironment(accounts, variables) {
|
|
98
|
+
return {
|
|
99
|
+
...variables,
|
|
100
|
+
PATH: [workerBin(accounts.stateDir), process.env.PATH ?? "/usr/local/bin:/usr/bin:/bin"].join(delimiter),
|
|
101
|
+
GIT_CONFIG_GLOBAL: workerGitConfig(accounts.stateDir),
|
|
102
|
+
GIT_CONFIG_SYSTEM: "/dev/null",
|
|
103
|
+
GIT_TERMINAL_PROMPT: "0"
|
|
104
|
+
};
|
|
105
|
+
}
|
|
9
106
|
// src/infra/commands.ts
|
|
10
107
|
/** Runs the Source CLIs (`gh`, `lark-cli`) and reads their JSON. Every call is bounded and never prompts. */
|
|
11
108
|
var CliError = class extends Error {
|
|
@@ -777,6 +874,10 @@ function assessing(options) {
|
|
|
777
874
|
}
|
|
778
875
|
};
|
|
779
876
|
}
|
|
877
|
+
new Intl.Segmenter("zh", { granularity: "word" });
|
|
878
|
+
/** Case-insensitive comparison for GitHub logins and repository names. */
|
|
879
|
+
const sameName = (a, b) => a.toLowerCase() === b.toLowerCase();
|
|
880
|
+
const escapeRegExp = (text) => text.replace(/[.*+?^${}()|[\]\\]/g, "\\$&");
|
|
780
881
|
// src/sources/github.ts
|
|
781
882
|
/**
|
|
782
883
|
* The GitHub Source: turns new mentions and new Issues in one repository into Triggers.
|
package/lib/index.mjs
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { A as
|
|
1
|
+
import { A as followupOwners, B as ticketOutcome, C as reasonText, D as key, E as ticketStage, F as reached, I as readUntil, L as runningAssignment, M as latestAssignment, N as latestReport, O as USER_ERRORS, P as liveTicket, R as settled, S as REASONS, T as canRetry, V as waitsForPerson, _ as AdmissionDirectionSchema, a as readSettings, b as directionAllowed, c as AGENT_NAMES, d as REPORT_FILE, f as readReport, g as readState, h as FileRepositories, i as parseYaml, j as isoTime, k as UserError, l as installed, n as SettingsSchema, o as stringifyYaml, p as reportInstructions, r as defaultSettings, s as writeSettings, t as SETTINGS_FILE, u as runnerFor, v as RuleAssessmentSchema, w as said, x as Engine, y as RuleMatchSchema, z as threadKey } from "./settings-Dud0f9wo.mjs";
|
|
2
2
|
// src/core/memory.ts
|
|
3
3
|
/** In-memory repository implementation for testing and ephemeral engine instances. */
|
|
4
4
|
const clone = (value) => structuredClone(value);
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { createHash } from "node:crypto";
|
|
2
2
|
import { z } from "zod";
|
|
3
|
-
import {
|
|
4
|
-
import { basename,
|
|
3
|
+
import { mkdir, readFile, readdir, rename, rm, stat, writeFile } from "node:fs/promises";
|
|
4
|
+
import { basename, join } from "node:path";
|
|
5
5
|
import { spawn } from "node:child_process";
|
|
6
6
|
// src/core/model.ts
|
|
7
7
|
/** Stable key of a thread across the whole domain. */
|
|
@@ -1926,138 +1926,11 @@ var Engine = class {
|
|
|
1926
1926
|
});
|
|
1927
1927
|
}
|
|
1928
1928
|
};
|
|
1929
|
-
// src/core/limits.ts
|
|
1930
|
-
/** Validation bounds shared between host schemas and management panel forms. */
|
|
1931
|
-
const LIMITS = {
|
|
1932
|
-
ruleName: 100,
|
|
1933
|
-
ruleInstruction: 2e3,
|
|
1934
|
-
evalTimeoutSeconds: {
|
|
1935
|
-
min: 30,
|
|
1936
|
-
max: 600
|
|
1937
|
-
},
|
|
1938
|
-
maxWorkers: {
|
|
1939
|
-
min: 1,
|
|
1940
|
-
max: 16
|
|
1941
|
-
},
|
|
1942
|
-
prepareCommand: 4e3,
|
|
1943
|
-
promptMaxChars: {
|
|
1944
|
-
min: 1e3,
|
|
1945
|
-
max: 1e6
|
|
1946
|
-
},
|
|
1947
|
-
admissionContextMaxPages: {
|
|
1948
|
-
min: 1,
|
|
1949
|
-
max: 100
|
|
1950
|
-
},
|
|
1951
|
-
admissionContextTimeoutMs: {
|
|
1952
|
-
min: 1,
|
|
1953
|
-
max: 9e4
|
|
1954
|
-
}
|
|
1955
|
-
};
|
|
1956
|
-
new Intl.Segmenter("zh", { granularity: "word" });
|
|
1957
|
-
/** Case-insensitive comparison for GitHub logins and repository names. */
|
|
1958
|
-
const sameName = (a, b) => a.toLowerCase() === b.toLowerCase();
|
|
1959
|
-
const escapeRegExp = (text) => text.replace(/[.*+?^${}()|[\]\\]/g, "\\$&");
|
|
1960
|
-
// src/infra/environment.ts
|
|
1961
|
-
/**
|
|
1962
|
-
* Writes the CLI shims and the isolated git configuration that bind a run to the agent's accounts.
|
|
1963
|
-
*
|
|
1964
|
-
* Each shim strips its own directory from PATH before it execs, so a wrapper script that resolves `gh` by name reaches the
|
|
1965
|
-
* real binary instead of looping. The git configuration replaces the operator's global configuration for the run, so a
|
|
1966
|
-
* worker cannot push with the operator's credentials.
|
|
1967
|
-
*
|
|
1968
|
-
* These are guardrails, not an OS boundary: a run shares the operator's OS user and can read their home directory.
|
|
1969
|
-
*/
|
|
1970
|
-
const MARKER = "# Written by superagent on every start; edits are lost.";
|
|
1971
|
-
/** Commands the shims provide, which a blocked list must never shadow. */
|
|
1972
|
-
const WORKER_COMMANDS = [
|
|
1973
|
-
"gh",
|
|
1974
|
-
"git",
|
|
1975
|
-
"lark-cli"
|
|
1976
|
-
];
|
|
1977
|
-
const workerBin = (stateDir) => join(stateDir, "worker-bin");
|
|
1978
|
-
const workerGitConfig = (stateDir) => join(stateDir, "worker-gitconfig");
|
|
1979
|
-
const shellQuote = (value) => `'${value.replaceAll("'", "'\\''")}'`;
|
|
1980
|
-
const gitQuote = (value) => `"${value.replace(/[\\"]/g, (char) => `\\${char}`)}"`;
|
|
1981
|
-
const credentialHelper = (cli) => `!${shellQuote(cli)} auth git-credential`;
|
|
1982
|
-
async function written(file) {
|
|
1983
|
-
try {
|
|
1984
|
-
const stat = await lstat(file);
|
|
1985
|
-
if (!stat.isFile() || stat.size > 4096) return false;
|
|
1986
|
-
return (await readFile(file, "utf8")).includes(MARKER);
|
|
1987
|
-
} catch {
|
|
1988
|
-
return false;
|
|
1989
|
-
}
|
|
1990
|
-
}
|
|
1991
|
-
async function own(file, content) {
|
|
1992
|
-
const temporary = `${file}.${process.pid}.tmp`;
|
|
1993
|
-
await writeFile(temporary, content, { mode: 384 });
|
|
1994
|
-
await rename(temporary, file);
|
|
1995
|
-
}
|
|
1996
|
-
/**
|
|
1997
|
-
* Writes the shims and git configuration, refusing to overwrite files it did not write.
|
|
1998
|
-
* @throws when a file in the shim directory or at the git configuration path was written by something else.
|
|
1999
|
-
*/
|
|
2000
|
-
async function writeEnvironment(accounts, blockedCommands) {
|
|
2001
|
-
const dir = workerBin(accounts.stateDir);
|
|
2002
|
-
await mkdir(dir, { recursive: true });
|
|
2003
|
-
const before = await readdir(dir);
|
|
2004
|
-
for (const name of before) if (!await written(join(dir, name))) throw new Error(`The file ${join(dir, name)} was not written by superagent; move it away or choose another state directory.`);
|
|
2005
|
-
const kept = /* @__PURE__ */ new Set();
|
|
2006
|
-
const shim = async (name, body) => {
|
|
2007
|
-
const temporary = join(dir, `.${name}.${process.pid}.tmp`);
|
|
2008
|
-
await writeFile(temporary, `#!/bin/sh\n${MARKER}\n${body}\n`, { mode: 493 });
|
|
2009
|
-
await rename(temporary, join(dir, name));
|
|
2010
|
-
kept.add(name);
|
|
2011
|
-
};
|
|
2012
|
-
const withoutShims = [
|
|
2013
|
-
`self=${shellQuote(dir)}`,
|
|
2014
|
-
"rest=",
|
|
2015
|
-
"IFS=:",
|
|
2016
|
-
"set -f",
|
|
2017
|
-
"for entry in $PATH; do [ \"$entry\" = \"$self\" ] || rest=\"${rest:+$rest:}$entry\"; done",
|
|
2018
|
-
"set +f",
|
|
2019
|
-
"unset IFS",
|
|
2020
|
-
"PATH=$rest",
|
|
2021
|
-
"export PATH"
|
|
2022
|
-
].join("\n");
|
|
2023
|
-
const run = (program) => `${withoutShims}\nexec ${shellQuote(program)} "$@"`;
|
|
2024
|
-
const fail = (message) => `echo ${shellQuote(message)} >&2\nexit 1`;
|
|
2025
|
-
await shim("gh", run(accounts.githubCli));
|
|
2026
|
-
await shim("lark-cli", accounts.feishuCli ? run(accounts.feishuCli) : fail("lark-cli is unavailable: this installation has no Feishu bot."));
|
|
2027
|
-
for (const name of new Set(blockedCommands.filter((name) => !WORKER_COMMANDS.includes(name)))) await shim(name, fail(`${name} is blocked in this installation; use gh, which acts as ${accounts.agentLogin}.`));
|
|
2028
|
-
for (const name of before) if (!kept.has(name)) await unlink(join(dir, name));
|
|
2029
|
-
await own(workerGitConfig(accounts.stateDir), [
|
|
2030
|
-
MARKER,
|
|
2031
|
-
"[user]",
|
|
2032
|
-
" useConfigOnly = true",
|
|
2033
|
-
"[credential]",
|
|
2034
|
-
" helper =",
|
|
2035
|
-
"[credential \"https://github.com\"]",
|
|
2036
|
-
`\thelper = ${gitQuote(credentialHelper(accounts.githubCli))}`,
|
|
2037
|
-
"[url \"https://github.com/\"]",
|
|
2038
|
-
" insteadOf = git@github.com:",
|
|
2039
|
-
" insteadOf = ssh://git@github.com:",
|
|
2040
|
-
"[filter \"lfs\"]",
|
|
2041
|
-
" clean = git-lfs clean -- %f",
|
|
2042
|
-
" smudge = git-lfs smudge -- %f",
|
|
2043
|
-
" process = git-lfs filter-process",
|
|
2044
|
-
" required = true"
|
|
2045
|
-
].join("\n") + "\n");
|
|
2046
|
-
}
|
|
2047
|
-
/** Environment variables a run receives, with the shim directory first on PATH. */
|
|
2048
|
-
function runEnvironment(accounts, variables) {
|
|
2049
|
-
return {
|
|
2050
|
-
...variables,
|
|
2051
|
-
PATH: [workerBin(accounts.stateDir), process.env.PATH ?? "/usr/local/bin:/usr/bin:/bin"].join(delimiter),
|
|
2052
|
-
GIT_CONFIG_GLOBAL: workerGitConfig(accounts.stateDir),
|
|
2053
|
-
GIT_CONFIG_SYSTEM: "/dev/null",
|
|
2054
|
-
GIT_TERMINAL_PROMPT: "0"
|
|
2055
|
-
};
|
|
2056
|
-
}
|
|
2057
1929
|
// src/core/policy.ts
|
|
2058
1930
|
/**
|
|
2059
|
-
*
|
|
2060
|
-
*
|
|
1931
|
+
* Assessment validation: the shape an assessor's verdict must have, and the check that an accepted verdict established
|
|
1932
|
+
* implementation intent with a settled target. The installation's own settings schema is `src/settings.ts`; this file
|
|
1933
|
+
* keeps no second copy of it.
|
|
2061
1934
|
*/
|
|
2062
1935
|
const RuleIdSchema = z.string().regex(/^[a-zA-Z0-9_-]{1,80}$/);
|
|
2063
1936
|
const RuleMatchSchema = z.object({
|
|
@@ -2080,81 +1953,6 @@ function directionAllowed(value) {
|
|
|
2080
1953
|
const result = AdmissionDirectionSchema.safeParse(value);
|
|
2081
1954
|
return result.success && result.data.implementation_requested && result.data.target_basis !== "undetermined" && !result.data.requires_design_decision;
|
|
2082
1955
|
}
|
|
2083
|
-
const DEFAULT_RULES = [{
|
|
2084
|
-
id: "copy",
|
|
2085
|
-
name: "Copy fixes",
|
|
2086
|
-
enabled: true,
|
|
2087
|
-
instruction: "Explicit requests to correct a typo, wording, punctuation or existing translation. Preserve product promises and business meaning."
|
|
2088
|
-
}, {
|
|
2089
|
-
id: "visual",
|
|
2090
|
-
name: "Visual fixes",
|
|
2091
|
-
enabled: true,
|
|
2092
|
-
instruction: "Explicit implementation requests for local spacing, alignment, overflow or styling, with a specified target or an objectively established existing standard/correct state to restore. Locating an element or calling it inconsistent, unattractive or hard to understand does not establish a target. Do not invent visual style, information hierarchy, rendering or interaction decisions. No redesign, new interaction or behavior. A known spacing defect does not authorize adjacent undefined restyling; assess only a clearly separable authorized scope. If direction or scope is unsettled, observe only: no acknowledgement, worker or unsolicited question."
|
|
2093
|
-
}];
|
|
2094
|
-
/** An assessment rule; its instruction may also specify PR reviewers and whether to wait for their approval. */
|
|
2095
|
-
const RuleSchema$1 = z.object({
|
|
2096
|
-
id: RuleIdSchema,
|
|
2097
|
-
name: z.string().trim().min(1).max(LIMITS.ruleName),
|
|
2098
|
-
enabled: z.boolean(),
|
|
2099
|
-
instruction: z.string().trim().min(1).max(LIMITS.ruleInstruction)
|
|
2100
|
-
}).strict();
|
|
2101
|
-
const RoleModelSchema = z.object({
|
|
2102
|
-
provider: z.string().trim().min(1),
|
|
2103
|
-
model: z.string().trim().min(1),
|
|
2104
|
-
reasoningEffort: z.string().trim().min(1).optional()
|
|
2105
|
-
}).strict();
|
|
2106
|
-
const AllowedSchema = z.object({
|
|
2107
|
-
id: z.string().trim().min(1).max(200),
|
|
2108
|
-
name: z.string().trim().max(100).optional()
|
|
2109
|
-
}).strict();
|
|
2110
|
-
const Weak = z.enum(["inferred", "ignore"]);
|
|
2111
|
-
const AdmissionRowSchema = z.object({
|
|
2112
|
-
listedUnaddressed: Weak.optional(),
|
|
2113
|
-
unlistedAddressed: z.enum([
|
|
2114
|
-
"explicit",
|
|
2115
|
-
"inferred",
|
|
2116
|
-
"ignore"
|
|
2117
|
-
]).optional(),
|
|
2118
|
-
unlistedUnaddressed: Weak.optional()
|
|
2119
|
-
}).strict();
|
|
2120
|
-
const AdmissionTableSchema = z.record(z.string(), AdmissionRowSchema);
|
|
2121
|
-
const SourcePolicySchema = z.object({
|
|
2122
|
-
allowed: z.array(AllowedSchema).default([]),
|
|
2123
|
-
admission: AdmissionTableSchema.default({})
|
|
2124
|
-
}).catchall(z.unknown());
|
|
2125
|
-
const PolicyConfigSchema = z.object({
|
|
2126
|
-
rules: z.array(RuleSchema$1).refine((rules) => new Set(rules.map((rule) => rule.id)).size === rules.length, "Duplicate rule IDs").default(DEFAULT_RULES),
|
|
2127
|
-
sources: z.record(z.string().regex(/^[a-z][a-z0-9-]*$/), SourcePolicySchema).default({})
|
|
2128
|
-
}).strict();
|
|
2129
|
-
const EvalConfigSchema = z.object({
|
|
2130
|
-
mode: z.enum([
|
|
2131
|
-
"off",
|
|
2132
|
-
"observe",
|
|
2133
|
-
"auto"
|
|
2134
|
-
]).default("observe"),
|
|
2135
|
-
timeoutSeconds: z.number().int().min(LIMITS.evalTimeoutSeconds.min).max(LIMITS.evalTimeoutSeconds.max).default(120),
|
|
2136
|
-
model: RoleModelSchema.nullable().default(null)
|
|
2137
|
-
}).strict();
|
|
2138
|
-
const CommandNameSchema = z.string().regex(/^[A-Za-z0-9._-]+$/).refine((name) => name !== "." && name !== "..", "Not a command name").refine((name) => !WORKER_COMMANDS.includes(name), `${WORKER_COMMANDS.join(", ")} cannot be blocked`);
|
|
2139
|
-
/** Executor settings: worker model, concurrency, ticket directory root (empty defaults to `<stateDir>/work`), `prepare` command, and blocked commands. */
|
|
2140
|
-
const ExecutorConfigSchema = z.object({
|
|
2141
|
-
model: RoleModelSchema.nullable().default(null),
|
|
2142
|
-
maxWorkers: z.number().int().min(LIMITS.maxWorkers.min).max(LIMITS.maxWorkers.max).default(3),
|
|
2143
|
-
directory: z.string().trim().refine((path) => path === "" || path.startsWith("/"), "An absolute path, or empty for <stateDir>/work").default(""),
|
|
2144
|
-
prepare: z.string().max(LIMITS.prepareCommand).default(""),
|
|
2145
|
-
blockedCommands: z.array(CommandNameSchema).default([])
|
|
2146
|
-
}).strict();
|
|
2147
|
-
const SourceInstanceSchema = z.object({
|
|
2148
|
-
enabled: z.boolean().default(true),
|
|
2149
|
-
config: z.record(z.string(), z.unknown()).default({})
|
|
2150
|
-
}).strict();
|
|
2151
|
-
z.object({
|
|
2152
|
-
paused: z.boolean().default(false),
|
|
2153
|
-
sources: z.record(z.string().regex(/^[a-z][a-z0-9-]*$/), SourceInstanceSchema).default({}),
|
|
2154
|
-
policy: PolicyConfigSchema.default(() => PolicyConfigSchema.parse({})),
|
|
2155
|
-
eval: EvalConfigSchema.default(() => EvalConfigSchema.parse({})),
|
|
2156
|
-
executor: ExecutorConfigSchema.default(() => ExecutorConfigSchema.parse({}))
|
|
2157
|
-
}).strict();
|
|
2158
1956
|
// src/state/files.ts
|
|
2159
1957
|
/**
|
|
2160
1958
|
* File-backed durable state.
|
|
@@ -3042,4 +2840,4 @@ function stringifyYaml(value, indent = 0) {
|
|
|
3042
2840
|
}).join("\n");
|
|
3043
2841
|
}
|
|
3044
2842
|
const needsQuote = (text) => text === "" || /^[\s"'-]|[:#]|\s$|^(true|false|null|~|-?\d+(\.\d+)?)$/.test(text);
|
|
3045
|
-
export {
|
|
2843
|
+
export { followupOwners as A, ticketOutcome as B, reasonText as C, key as D, ticketStage as E, reached as F, readUntil as I, runningAssignment as L, latestAssignment as M, latestReport as N, USER_ERRORS as O, liveTicket as P, settled as R, REASONS as S, canRetry as T, waitsForPerson as V, AdmissionDirectionSchema as _, readSettings as a, directionAllowed as b, AGENT_NAMES as c, REPORT_FILE as d, readReport as f, readState as g, FileRepositories as h, parseYaml as i, isoTime as j, UserError as k, installed as l, runProcess as m, SettingsSchema as n, stringifyYaml as o, reportInstructions as p, defaultSettings as r, writeSettings as s, SETTINGS_FILE as t, runnerFor as u, RuleAssessmentSchema as v, said as w, Engine as x, RuleMatchSchema as y, threadKey as z };
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "superagent-skill",
|
|
3
|
-
"version": "0.4.
|
|
3
|
+
"version": "0.4.1",
|
|
4
4
|
"type": "module",
|
|
5
5
|
"description": "A headless, file-backed agent that turns requests from GitHub issues, Feishu chats, or Twitter mentions into tickets and runs each ticket on a configurable coding agent: Claude Code, Codex or opencode.",
|
|
6
6
|
"bin": {
|