@fro.bot/systematic 3.31.6 → 3.32.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/HARNESSES.md +18 -0
- package/README.md +1 -1
- package/agents/research/connections-researcher.md +101 -0
- package/dist/ce-connect-helper.d.ts +76 -0
- package/dist/cli.js +1 -1
- package/dist/{index-c95n6n53.js → index-nrbdgp4m.js} +277 -228
- package/dist/index.js +68 -3
- package/dist/lib/bundled-names.d.ts +3 -3
- package/dist/lib/config-protected-fields.d.ts +1 -1
- package/dist/lib/config-schema.d.ts +6 -0
- package/dist/lib/config.d.ts +10 -0
- package/dist/lib/connect-config.d.ts +197 -0
- package/dist/lib/connect-evidence.d.ts +312 -0
- package/dist/lib/connect-helper-core.d.ts +399 -0
- package/dist/lib/connect-state.d.ts +427 -0
- package/dist/lib/opencode-v2-tool-guard.d.ts +40 -0
- package/dist/lib/opencode-v2.d.ts +3 -1
- package/dist/lib/pi-subagents-personas.d.ts +1 -0
- package/dist/lib/validation.d.ts +1 -0
- package/dist/pi.js +53 -6
- package/package.json +3 -1
- package/skills/ce-compound/SKILL.md +39 -2
- package/skills/ce-compound/references/candidate-input.md +91 -0
- package/skills/ce-compound-refresh/SKILL.md +48 -2
- package/skills/ce-connect/SKILL.md +201 -0
- package/skills/ce-connect/references/candidate-contract.md +97 -0
- package/skills/ce-connect/references/headless-and-outcomes.md +86 -0
- package/skills/ce-connect/scripts/connect.mjs +9739 -0
package/dist/index.js
CHANGED
|
@@ -26,7 +26,7 @@ import {
|
|
|
26
26
|
SEARCH_NOTICES,
|
|
27
27
|
SEARCH_CONFIG_UNREADABLE_NOTE,
|
|
28
28
|
runSearch
|
|
29
|
-
} from "./index-
|
|
29
|
+
} from "./index-nrbdgp4m.js";
|
|
30
30
|
|
|
31
31
|
// src/index.ts
|
|
32
32
|
import path8 from "path";
|
|
@@ -1863,6 +1863,41 @@ var installSkills = async ({
|
|
|
1863
1863
|
await guard.async("skill output restore registration", () => ctx.session.hook("context", restore))();
|
|
1864
1864
|
};
|
|
1865
1865
|
|
|
1866
|
+
// src/lib/opencode-v2-tool-guard.ts
|
|
1867
|
+
var READ_ONLY_AGENT_NAMES = [
|
|
1868
|
+
"connections-researcher"
|
|
1869
|
+
];
|
|
1870
|
+
var READ_ONLY_TOOL_ALLOWLIST = [
|
|
1871
|
+
"read",
|
|
1872
|
+
"grep",
|
|
1873
|
+
"glob",
|
|
1874
|
+
"skill",
|
|
1875
|
+
"systematic_search",
|
|
1876
|
+
"systematic_skill"
|
|
1877
|
+
];
|
|
1878
|
+
var ALLOWED = { allowed: true };
|
|
1879
|
+
function decideToolCall(agent, tool) {
|
|
1880
|
+
if (typeof agent !== "string" || !READ_ONLY_AGENT_NAMES.includes(agent)) {
|
|
1881
|
+
return ALLOWED;
|
|
1882
|
+
}
|
|
1883
|
+
if (typeof tool === "string" && READ_ONLY_TOOL_ALLOWLIST.includes(tool)) {
|
|
1884
|
+
return ALLOWED;
|
|
1885
|
+
}
|
|
1886
|
+
const name = typeof tool === "string" ? tool : "unknown";
|
|
1887
|
+
return {
|
|
1888
|
+
allowed: false,
|
|
1889
|
+
message: `The tool "${name}" is not available to the read-only ${agent} agent. It may call only: ${READ_ONLY_TOOL_ALLOWLIST.join(", ")}.`
|
|
1890
|
+
};
|
|
1891
|
+
}
|
|
1892
|
+
function refuseOutsideAllowlist(event) {
|
|
1893
|
+
const verdict = decideToolCall(event.agent, event.tool);
|
|
1894
|
+
if (!verdict.allowed)
|
|
1895
|
+
throw new Error(verdict.message);
|
|
1896
|
+
}
|
|
1897
|
+
var installToolGuard = async ({ ctx }) => {
|
|
1898
|
+
await ctx.tool.hook("execute.before", refuseOutsideAllowlist);
|
|
1899
|
+
};
|
|
1900
|
+
|
|
1866
1901
|
// src/lib/opencode-v2.ts
|
|
1867
1902
|
var DIAGNOSTIC_PREFIX = "systematic:";
|
|
1868
1903
|
function describeFailure(error) {
|
|
@@ -1970,12 +2005,14 @@ var installAgents = async ({ ctx, snapshot, guard }) => {
|
|
|
1970
2005
|
};
|
|
1971
2006
|
var DEFAULT_INSTALLERS = {
|
|
1972
2007
|
agents: installAgents,
|
|
2008
|
+
toolGuard: installToolGuard,
|
|
1973
2009
|
skills: installSkills,
|
|
1974
2010
|
search: installSearch,
|
|
1975
2011
|
commands: installCommands,
|
|
1976
2012
|
bootstrap: installBootstrap
|
|
1977
2013
|
};
|
|
1978
2014
|
var INSTALLER_ORDER = [
|
|
2015
|
+
"toolGuard",
|
|
1979
2016
|
"agents",
|
|
1980
2017
|
"skills",
|
|
1981
2018
|
"search",
|
|
@@ -2048,17 +2085,45 @@ function buildSnapshot(ctx, deps) {
|
|
|
2048
2085
|
});
|
|
2049
2086
|
}
|
|
2050
2087
|
async function setupOpenCodeV2(ctx, deps) {
|
|
2051
|
-
const
|
|
2052
|
-
if (
|
|
2088
|
+
const built = buildSnapshot(ctx, deps);
|
|
2089
|
+
if (built === undefined)
|
|
2053
2090
|
return;
|
|
2054
2091
|
const guard = createSafeGuard();
|
|
2055
2092
|
const report = reportDiagnostic;
|
|
2056
2093
|
const installers = { ...DEFAULT_INSTALLERS, ...deps.installers };
|
|
2094
|
+
let snapshot = built;
|
|
2057
2095
|
for (const slot of INSTALLER_ORDER) {
|
|
2096
|
+
if (slot === "toolGuard") {
|
|
2097
|
+
if (!await installGuardOrReport(installers.toolGuard, ctx, snapshot)) {
|
|
2098
|
+
snapshot = withoutGuardedAgents(snapshot);
|
|
2099
|
+
}
|
|
2100
|
+
continue;
|
|
2101
|
+
}
|
|
2058
2102
|
const install = guard.async(`${slot} installer`, installers[slot]);
|
|
2059
2103
|
await install({ ctx, snapshot, guard, report });
|
|
2060
2104
|
}
|
|
2061
2105
|
}
|
|
2106
|
+
async function installGuardOrReport(install, ctx, snapshot) {
|
|
2107
|
+
try {
|
|
2108
|
+
await install({
|
|
2109
|
+
ctx,
|
|
2110
|
+
snapshot,
|
|
2111
|
+
guard: createSafeGuard(),
|
|
2112
|
+
report: reportDiagnostic
|
|
2113
|
+
});
|
|
2114
|
+
return true;
|
|
2115
|
+
} catch (error) {
|
|
2116
|
+
reportDiagnostic(`tool guard registration failed: ${messageOf(error)}; the read-only agents (${READ_ONLY_AGENT_NAMES.join(", ")}) are not installed`);
|
|
2117
|
+
return false;
|
|
2118
|
+
}
|
|
2119
|
+
}
|
|
2120
|
+
function withoutGuardedAgents(snapshot) {
|
|
2121
|
+
const agents = Object.fromEntries(Object.entries(snapshot.plan.agents).filter(([name]) => !READ_ONLY_AGENT_NAMES.includes(name)));
|
|
2122
|
+
return Object.freeze({
|
|
2123
|
+
...snapshot,
|
|
2124
|
+
plan: { ...snapshot.plan, agents }
|
|
2125
|
+
});
|
|
2126
|
+
}
|
|
2062
2127
|
|
|
2063
2128
|
// src/index.ts
|
|
2064
2129
|
var __dirname2 = path8.dirname(fileURLToPath(import.meta.url));
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
export declare const BUNDLED_AGENT_NAMES: readonly ['adversarial-document-reviewer', 'adversarial-reviewer', 'agent-native-reviewer', 'api-contract-reviewer', 'architecture-strategist', 'best-practices-researcher', 'bug-reproduction-validator', 'cli-readiness-reviewer', 'code-simplicity-reviewer', 'coherence-reviewer', 'correctness-reviewer', 'data-migrations-reviewer', 'deployment-verification-agent', 'design-iterator', 'design-lens-reviewer', 'feasibility-reviewer', 'framework-docs-researcher', 'git-history-analyzer', 'issue-intelligence-analyst', 'kieran-typescript-reviewer', 'learnings-researcher', 'maintainability-reviewer', 'pattern-recognition-specialist', 'performance-reviewer', 'pr-comment-resolver', 'previous-comments-reviewer', 'product-lens-reviewer', 'project-standards-reviewer', 'reliability-reviewer', 'repo-research-analyst', 'scope-guardian-reviewer', 'security-lens-reviewer', 'security-reviewer', 'slack-researcher', 'spec-flow-analyzer', 'systematic-implementer', 'testing-reviewer'];
|
|
2
|
-
export declare const BUNDLED_AGENT_QUALIFIED_IDS: readonly ['design/design-iterator', 'document-review/adversarial-document-reviewer', 'document-review/coherence-reviewer', 'document-review/design-lens-reviewer', 'document-review/feasibility-reviewer', 'document-review/product-lens-reviewer', 'document-review/scope-guardian-reviewer', 'document-review/security-lens-reviewer', 'research/best-practices-researcher', 'research/framework-docs-researcher', 'research/git-history-analyzer', 'research/issue-intelligence-analyst', 'research/learnings-researcher', 'research/repo-research-analyst', 'research/slack-researcher', 'review/adversarial-reviewer', 'review/agent-native-reviewer', 'review/api-contract-reviewer', 'review/architecture-strategist', 'review/cli-readiness-reviewer', 'review/code-simplicity-reviewer', 'review/correctness-reviewer', 'review/data-migrations-reviewer', 'review/deployment-verification-agent', 'review/kieran-typescript-reviewer', 'review/maintainability-reviewer', 'review/pattern-recognition-specialist', 'review/performance-reviewer', 'review/previous-comments-reviewer', 'review/project-standards-reviewer', 'review/reliability-reviewer', 'review/security-reviewer', 'review/testing-reviewer', 'workflow/bug-reproduction-validator', 'workflow/pr-comment-resolver', 'workflow/spec-flow-analyzer', 'workflow/systematic-implementer'];
|
|
3
|
-
export declare const BUNDLED_SKILL_NAMES: readonly ['agent-browser', 'agent-native-architecture', 'agent-native-audit', 'ce:brainstorm', 'ce:compound', 'ce:compound-refresh', 'ce:ideate', 'ce:plan', 'ce:review', 'ce:review-cleanup', 'ce:work', 'compound-docs', 'deepen-plan', 'deploy-docs', 'document-review', 'frontend-design', 'git-clean-gone-branches', 'git-commit', 'git-commit-push-pr', 'git-worktree', 'lfg', 'onboarding', 'orchestrating-subagents', 'pr-attachments', 'report-bug-ce', 'reproduce-bug', 'resolve-pr-feedback', 'slfg', 'test-browser', 'test-driven-development', 'todos', 'using-systematic', 'writing-skills'];
|
|
1
|
+
export declare const BUNDLED_AGENT_NAMES: readonly ['adversarial-document-reviewer', 'adversarial-reviewer', 'agent-native-reviewer', 'api-contract-reviewer', 'architecture-strategist', 'best-practices-researcher', 'bug-reproduction-validator', 'cli-readiness-reviewer', 'code-simplicity-reviewer', 'coherence-reviewer', 'connections-researcher', 'correctness-reviewer', 'data-migrations-reviewer', 'deployment-verification-agent', 'design-iterator', 'design-lens-reviewer', 'feasibility-reviewer', 'framework-docs-researcher', 'git-history-analyzer', 'issue-intelligence-analyst', 'kieran-typescript-reviewer', 'learnings-researcher', 'maintainability-reviewer', 'pattern-recognition-specialist', 'performance-reviewer', 'pr-comment-resolver', 'previous-comments-reviewer', 'product-lens-reviewer', 'project-standards-reviewer', 'reliability-reviewer', 'repo-research-analyst', 'scope-guardian-reviewer', 'security-lens-reviewer', 'security-reviewer', 'slack-researcher', 'spec-flow-analyzer', 'systematic-implementer', 'testing-reviewer'];
|
|
2
|
+
export declare const BUNDLED_AGENT_QUALIFIED_IDS: readonly ['design/design-iterator', 'document-review/adversarial-document-reviewer', 'document-review/coherence-reviewer', 'document-review/design-lens-reviewer', 'document-review/feasibility-reviewer', 'document-review/product-lens-reviewer', 'document-review/scope-guardian-reviewer', 'document-review/security-lens-reviewer', 'research/best-practices-researcher', 'research/connections-researcher', 'research/framework-docs-researcher', 'research/git-history-analyzer', 'research/issue-intelligence-analyst', 'research/learnings-researcher', 'research/repo-research-analyst', 'research/slack-researcher', 'review/adversarial-reviewer', 'review/agent-native-reviewer', 'review/api-contract-reviewer', 'review/architecture-strategist', 'review/cli-readiness-reviewer', 'review/code-simplicity-reviewer', 'review/correctness-reviewer', 'review/data-migrations-reviewer', 'review/deployment-verification-agent', 'review/kieran-typescript-reviewer', 'review/maintainability-reviewer', 'review/pattern-recognition-specialist', 'review/performance-reviewer', 'review/previous-comments-reviewer', 'review/project-standards-reviewer', 'review/reliability-reviewer', 'review/security-reviewer', 'review/testing-reviewer', 'workflow/bug-reproduction-validator', 'workflow/pr-comment-resolver', 'workflow/spec-flow-analyzer', 'workflow/systematic-implementer'];
|
|
3
|
+
export declare const BUNDLED_SKILL_NAMES: readonly ['agent-browser', 'agent-native-architecture', 'agent-native-audit', 'ce:brainstorm', 'ce:compound', 'ce:compound-refresh', 'ce:connect', 'ce:ideate', 'ce:plan', 'ce:review', 'ce:review-cleanup', 'ce:work', 'compound-docs', 'deepen-plan', 'deploy-docs', 'document-review', 'frontend-design', 'git-clean-gone-branches', 'git-commit', 'git-commit-push-pr', 'git-worktree', 'lfg', 'onboarding', 'orchestrating-subagents', 'pr-attachments', 'report-bug-ce', 'reproduce-bug', 'resolve-pr-feedback', 'slfg', 'test-browser', 'test-driven-development', 'todos', 'using-systematic', 'writing-skills'];
|
|
4
4
|
export type BundledAgentName = (typeof BUNDLED_AGENT_NAMES)[number];
|
|
5
5
|
export type BundledSkillName = (typeof BUNDLED_SKILL_NAMES)[number];
|
|
@@ -18,5 +18,5 @@
|
|
|
18
18
|
* reason it exists as a separate file rather than living directly in
|
|
19
19
|
* `config.ts`.
|
|
20
20
|
*/
|
|
21
|
-
export declare const CONFIG_PROTECTED_FIELD_PATHS: readonly ['profiles', 'allow_project_profiles', 'search.enabled', 'search.allow_project_sources', 'agents.*.model', 'agents.*.permission', 'agents.*.skills', 'agents.*.variant', 'agents.*.opencode', 'agents.*.pi', 'categories.*.model', 'categories.*.permission', 'categories.*.skills', 'categories.*.variant', 'categories.*.opencode', 'categories.*.pi'];
|
|
21
|
+
export declare const CONFIG_PROTECTED_FIELD_PATHS: readonly ['profiles', 'allow_project_profiles', 'search.enabled', 'search.allow_project_sources', 'connect', 'agents.*.model', 'agents.*.permission', 'agents.*.skills', 'agents.*.variant', 'agents.*.opencode', 'agents.*.pi', 'categories.*.model', 'categories.*.permission', 'categories.*.skills', 'categories.*.variant', 'categories.*.opencode', 'categories.*.pi'];
|
|
22
22
|
export type ConfigProtectedFieldPath = (typeof CONFIG_PROTECTED_FIELD_PATHS)[number];
|
|
@@ -399,6 +399,9 @@ export declare function createSystematicConfigSchema(opts: SystematicConfigSchem
|
|
|
399
399
|
exclude: z.ZodOptional<z.ZodArray<z.ZodString>>;
|
|
400
400
|
}, z.core.$strict>>>;
|
|
401
401
|
}, z.core.$strict>>;
|
|
402
|
+
connect: z.ZodOptional<z.ZodObject<{
|
|
403
|
+
allow_projects: z.ZodOptional<z.ZodArray<z.ZodString>>;
|
|
404
|
+
}, z.core.$strict>>;
|
|
402
405
|
disabled_skills: z.ZodDefault<z.ZodArray<z.ZodEnum<{
|
|
403
406
|
[x: string]: string;
|
|
404
407
|
}>>>;
|
|
@@ -608,6 +611,9 @@ export declare const SystematicConfigSchema: z.ZodObject<{
|
|
|
608
611
|
exclude: z.ZodOptional<z.ZodArray<z.ZodString>>;
|
|
609
612
|
}, z.core.$strict>>>;
|
|
610
613
|
}, z.core.$strict>>;
|
|
614
|
+
connect: z.ZodOptional<z.ZodObject<{
|
|
615
|
+
allow_projects: z.ZodOptional<z.ZodArray<z.ZodString>>;
|
|
616
|
+
}, z.core.$strict>>;
|
|
611
617
|
disabled_skills: z.ZodDefault<z.ZodArray<z.ZodEnum<{
|
|
612
618
|
[x: string]: string;
|
|
613
619
|
}>>>;
|
package/dist/lib/config.d.ts
CHANGED
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import { CONFIG_PROTECTED_FIELD_PATHS, type ConfigProtectedFieldPath } from './config-protected-fields.js';
|
|
2
|
+
import type { ConnectSettings } from './connect-config.js';
|
|
2
3
|
import { type RoutingTarget } from './routing-resolver.js';
|
|
3
4
|
import { type SearchSchemaOutput } from './search-user-config.js';
|
|
4
5
|
export interface BootstrapConfig {
|
|
@@ -198,6 +199,15 @@ export interface SystematicConfig {
|
|
|
198
199
|
* `config unreadable` note. Absent otherwise.
|
|
199
200
|
*/
|
|
200
201
|
searchUnreadable?: boolean;
|
|
202
|
+
/**
|
|
203
|
+
* Merged `connect` settings from user and custom config only: the
|
|
204
|
+
* `allow_projects` lists of every layer that sets one, as a union. Absent
|
|
205
|
+
* when no layer sets the block, which allows no project. A project
|
|
206
|
+
* config's `connect` is stripped at load with a warning and never appears
|
|
207
|
+
* here. The `ce:connect` helper reads the same files itself
|
|
208
|
+
* (`loadConnectAllowList`) and never consults this value.
|
|
209
|
+
*/
|
|
210
|
+
connect?: ConnectSettings;
|
|
201
211
|
}
|
|
202
212
|
export declare const DEFAULT_CONFIG: SystematicConfig;
|
|
203
213
|
/**
|
|
@@ -0,0 +1,197 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* The `connect` config block: the allow list of projects that `ce:connect`
|
|
3
|
+
* may read, a reader that fails closed, a per-entry resolver that says why an
|
|
4
|
+
* entry did not match, and the table of hosts where the researcher's tool
|
|
5
|
+
* denies have been observed.
|
|
6
|
+
*
|
|
7
|
+
* Import rule: this module may import only `jsonc-parser`, node builtins,
|
|
8
|
+
* `search-bounded-read.ts` and `search-project-identity.ts` (both node
|
|
9
|
+
* builtins only). It must never import zod, `config.ts`, `config-schema.ts` or
|
|
10
|
+
* `search-user-config.ts`: the `ce:connect` helper bundles it, and any of those
|
|
11
|
+
* would drag the config loader and zod into that bundle. `config-schema.ts`
|
|
12
|
+
* imports the limits from here and tags the same block `trust:
|
|
13
|
+
* 'project-or-higher'`; the dependency runs one way.
|
|
14
|
+
*
|
|
15
|
+
* Trust: `connect` is user-only. User config, `OPENCODE_CONFIG_DIR` config and
|
|
16
|
+
* the `systematic.local` file beside each may set it. `config.ts` strips it
|
|
17
|
+
* from project config with a warning, and this reader never opens a project
|
|
18
|
+
* file at all, so a repository cannot widen the list on any surface.
|
|
19
|
+
*
|
|
20
|
+
* Fail closed: the block is validated whole. An unknown key, a wrong type or
|
|
21
|
+
* a list over its limit makes that layer's block unreadable, and an
|
|
22
|
+
* unreadable block contributes no entries. A missing, unparseable, oversize
|
|
23
|
+
* or non-regular file contributes none either. No failure can add an entry
|
|
24
|
+
* the user did not write. The four layers merge by union, so a layer that
|
|
25
|
+
* fails drops only its own entries.
|
|
26
|
+
*
|
|
27
|
+
* Warnings name config files and reasons, never an allow-list entry: an entry
|
|
28
|
+
* is a project the user chose to expose, and a warning can reach logs and
|
|
29
|
+
* replies that the project is not allowed to see.
|
|
30
|
+
*/
|
|
31
|
+
/** The allow list holds at most this many entries. */
|
|
32
|
+
export declare const MAX_ALLOW_PROJECTS = 64;
|
|
33
|
+
/** One allow-list entry is at most this many characters. */
|
|
34
|
+
export declare const MAX_ALLOW_PROJECT_LENGTH = 4096;
|
|
35
|
+
/** Largest config file the reader accepts. A larger file is unreadable. */
|
|
36
|
+
export declare const MAX_CONNECT_CONFIG_BYTES: number;
|
|
37
|
+
export interface ConnectSettings {
|
|
38
|
+
allow_projects: string[];
|
|
39
|
+
}
|
|
40
|
+
export type ConnectBlockValidation = {
|
|
41
|
+
readonly ok: true;
|
|
42
|
+
readonly allowProjects: string[];
|
|
43
|
+
} | {
|
|
44
|
+
readonly ok: false;
|
|
45
|
+
};
|
|
46
|
+
/**
|
|
47
|
+
* Validate a `connect` block with plain guards. The block is valid when it is
|
|
48
|
+
* an object whose only key, if any, is `allow_projects`, holding at most
|
|
49
|
+
* `MAX_ALLOW_PROJECTS` non-empty strings of at most `MAX_ALLOW_PROJECT_LENGTH`
|
|
50
|
+
* characters. The zod schema in `config-schema.ts` accepts and rejects the
|
|
51
|
+
* same values; a test pins the two together.
|
|
52
|
+
*/
|
|
53
|
+
export declare function validateConnectBlock(value: unknown): ConnectBlockValidation;
|
|
54
|
+
export interface ConnectConfigOptions {
|
|
55
|
+
readonly homeDir?: string;
|
|
56
|
+
readonly userConfigDir?: string;
|
|
57
|
+
/** `null` or a blank string means no custom directory. Leave the key out to read `OPENCODE_CONFIG_DIR`. */
|
|
58
|
+
readonly customConfigDir?: string | null;
|
|
59
|
+
}
|
|
60
|
+
export interface ConnectConfigDirs {
|
|
61
|
+
readonly homeDir: string;
|
|
62
|
+
readonly userConfigDir: string;
|
|
63
|
+
readonly customConfigDir: string | undefined;
|
|
64
|
+
}
|
|
65
|
+
export type ConnectConfigLayer = 'user' | 'user.local' | 'custom' | 'custom.local';
|
|
66
|
+
export interface ConnectConfigFile {
|
|
67
|
+
readonly layer: ConnectConfigLayer;
|
|
68
|
+
readonly path: string;
|
|
69
|
+
}
|
|
70
|
+
export interface ConnectConfigSelection {
|
|
71
|
+
readonly files: readonly ConnectConfigFile[];
|
|
72
|
+
/** The custom directory is the user directory, spelled the same way or reached through a symlink. */
|
|
73
|
+
readonly aliased: boolean;
|
|
74
|
+
}
|
|
75
|
+
export declare function resolveConnectConfigDirs(options?: ConnectConfigOptions): ConnectConfigDirs;
|
|
76
|
+
export declare function selectConnectConfigFiles(dirs: ConnectConfigDirs): ConnectConfigSelection;
|
|
77
|
+
export type ContainerRefusal = 'checkout' | 'allowed-root';
|
|
78
|
+
/**
|
|
79
|
+
* Why `dir` may not hold configuration or state, or `undefined` when it may.
|
|
80
|
+
* A directory is refused when it is, or sits inside, an allowed root
|
|
81
|
+
* (`allowed-root`), or when it or any ancestor holds a `.git` entry
|
|
82
|
+
* (`checkout`). A repository is untrusted input, so what it holds must not
|
|
83
|
+
* steer what the helper reads or where it writes. Both sides are compared as
|
|
84
|
+
* realpaths when they exist.
|
|
85
|
+
*/
|
|
86
|
+
export declare function containerRefusal(dir: string, allowedRoots: readonly string[]): ContainerRefusal | undefined;
|
|
87
|
+
export interface ConnectAllowListLoad {
|
|
88
|
+
/** The union of the readable layers' entries, in layer order, duplicates removed. */
|
|
89
|
+
readonly allowProjects: readonly string[];
|
|
90
|
+
/** Some layer's file or block could not be read and contributed nothing. */
|
|
91
|
+
readonly unreadable: boolean;
|
|
92
|
+
/** One line per problem. They name files and reasons, never an allow-list entry. */
|
|
93
|
+
readonly warnings: readonly string[];
|
|
94
|
+
/** Set when the custom config directory was refused and none of its files were read. */
|
|
95
|
+
readonly customDirRefused?: ContainerRefusal;
|
|
96
|
+
}
|
|
97
|
+
/**
|
|
98
|
+
* Read the allow list from the user-level files: user, user.local, then
|
|
99
|
+
* custom and custom.local when a custom directory is set. It never reads
|
|
100
|
+
* project config and never throws.
|
|
101
|
+
*
|
|
102
|
+
* The custom directory is refused, and none of its files are opened, when it
|
|
103
|
+
* is inside an allowed root of the user layers or inside a checkout: a
|
|
104
|
+
* repository must not be able to supply the file that names the projects the
|
|
105
|
+
* helper reads. A custom directory that is the user directory is not a second
|
|
106
|
+
* source and is not refused.
|
|
107
|
+
*/
|
|
108
|
+
export declare function loadConnectAllowList(options?: ConnectConfigOptions): ConnectAllowListLoad;
|
|
109
|
+
/** Why an allow-list entry matched no project. */
|
|
110
|
+
export type AllowEntryMissReason =
|
|
111
|
+
/** Not an absolute path once `~` is expanded. */
|
|
112
|
+
'not-absolute'
|
|
113
|
+
/** The path does not exist. */
|
|
114
|
+
| 'stale'
|
|
115
|
+
/** The path exists but is not a repository, and none encloses it. */
|
|
116
|
+
| 'not-a-repository'
|
|
117
|
+
/** The path is inside a repository, or a linked worktree: only the main root is allowed. */
|
|
118
|
+
| 'not-main-root'
|
|
119
|
+
/** The path or its repository layout could not be read or verified. */
|
|
120
|
+
| 'unreadable';
|
|
121
|
+
export type AllowEntryResolution = {
|
|
122
|
+
readonly status: 'resolved';
|
|
123
|
+
readonly entry: string;
|
|
124
|
+
/** The verified main repository root, as a realpath. */
|
|
125
|
+
readonly mainRoot: string;
|
|
126
|
+
} | {
|
|
127
|
+
readonly status: 'unmatched';
|
|
128
|
+
readonly entry: string;
|
|
129
|
+
readonly reason: AllowEntryMissReason;
|
|
130
|
+
};
|
|
131
|
+
export interface AllowEntryOptions {
|
|
132
|
+
/** Home directory for `~` entries. Defaults to `os.homedir()`. */
|
|
133
|
+
readonly homeDir?: string;
|
|
134
|
+
}
|
|
135
|
+
/**
|
|
136
|
+
* Resolve one allow-list entry to a verified main repository root, or say why
|
|
137
|
+
* it did not match. The entry is expanded (`~`), realpathed, and its identity
|
|
138
|
+
* derived with `resolveProjectIdentity`; the main root must equal the entry's
|
|
139
|
+
* realpath exactly, so a subdirectory and a linked worktree are not accepted.
|
|
140
|
+
* Never throws.
|
|
141
|
+
*/
|
|
142
|
+
export declare function resolveAllowEntry(entry: string, options?: AllowEntryOptions): AllowEntryResolution;
|
|
143
|
+
export interface ResolvedAllowList {
|
|
144
|
+
readonly resolved: ReadonlyArray<{
|
|
145
|
+
readonly entry: string;
|
|
146
|
+
readonly mainRoot: string;
|
|
147
|
+
}>;
|
|
148
|
+
readonly unmatched: ReadonlyArray<{
|
|
149
|
+
readonly entry: string;
|
|
150
|
+
readonly reason: AllowEntryMissReason;
|
|
151
|
+
}>;
|
|
152
|
+
}
|
|
153
|
+
/**
|
|
154
|
+
* Resolve every entry. Two entries that name one project collapse into the
|
|
155
|
+
* first; a later duplicate is neither resolved nor unmatched.
|
|
156
|
+
*/
|
|
157
|
+
export declare function resolveAllowList(entries: readonly string[], options?: AllowEntryOptions): ResolvedAllowList;
|
|
158
|
+
export declare const CONNECT_HOSTS: readonly ['opencode-v1', 'opencode-v2', 'pi', 'claude-code'];
|
|
159
|
+
export type ConnectHost = (typeof CONNECT_HOSTS)[number];
|
|
160
|
+
/**
|
|
161
|
+
* One host and exact version where the researcher's shell, write and web tools
|
|
162
|
+
* were observed denied on a real host. `observedBy` names the test that
|
|
163
|
+
* observed it, as `<file> > <test title>`. A host whose proof cannot be an
|
|
164
|
+
* automated test names a manual record instead, as `HARNESSES.md > <entry id>`;
|
|
165
|
+
* a unit test requires that entry to exist and to be marked manual evidence. A
|
|
166
|
+
* row without `observedBy` never matches.
|
|
167
|
+
*/
|
|
168
|
+
export interface HostSupportRow {
|
|
169
|
+
readonly host: ConnectHost;
|
|
170
|
+
readonly version: string;
|
|
171
|
+
readonly observedBy: string;
|
|
172
|
+
}
|
|
173
|
+
/**
|
|
174
|
+
* The supported combinations. A row is added only for a host and version where
|
|
175
|
+
* a real-host deny was observed against the shipped agent, and it names the
|
|
176
|
+
* test or the recorded manual run that observed it. The `claude-code` row rests
|
|
177
|
+
* on a manual run with a live model, because that host cannot be
|
|
178
|
+
* driven by a scripted one here.
|
|
179
|
+
*
|
|
180
|
+
* Every row is exact: the version is the one the proof ran against, and any
|
|
181
|
+
* other version, older or newer, is unlisted.
|
|
182
|
+
*/
|
|
183
|
+
export declare const HOST_SUPPORT_TABLE: readonly HostSupportRow[];
|
|
184
|
+
export type HostSupportVerdict = {
|
|
185
|
+
readonly supported: true;
|
|
186
|
+
readonly row: HostSupportRow;
|
|
187
|
+
} | {
|
|
188
|
+
readonly supported: false;
|
|
189
|
+
/** `unobserved`: no usable version. `unlisted`: no row names this host and version. */
|
|
190
|
+
readonly reason: 'unobserved' | 'unlisted';
|
|
191
|
+
};
|
|
192
|
+
/**
|
|
193
|
+
* Check an observed host and version against the table. The match is exact:
|
|
194
|
+
* a version that is not listed is refused, whether older or newer. A pair the
|
|
195
|
+
* skill could not observe is unsupported.
|
|
196
|
+
*/
|
|
197
|
+
export declare function checkHostSupport(host: unknown, version: unknown, table?: readonly HostSupportRow[]): HostSupportVerdict;
|