@code-yeongyu/senpi 2026.6.3 → 2026.6.4
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 +19 -9
- package/README.md +2 -0
- package/dist/bun/cli.d.ts.map +1 -1
- package/dist/bun/cli.js +1 -1
- package/dist/bun/cli.js.map +1 -1
- package/dist/cli/args.d.ts.map +1 -1
- package/dist/cli/args.js +2 -0
- package/dist/cli/args.js.map +1 -1
- package/dist/cli-main.d.ts +3 -0
- package/dist/cli-main.d.ts.map +1 -0
- package/dist/cli-main.js +10 -0
- package/dist/cli-main.js.map +1 -0
- package/dist/cli.d.ts.map +1 -1
- package/dist/cli.js +46 -13
- package/dist/cli.js.map +1 -1
- package/dist/core/auth-storage.d.ts.map +1 -1
- package/dist/core/auth-storage.js +4 -3
- package/dist/core/auth-storage.js.map +1 -1
- package/dist/core/export-html/template.js +19 -6
- package/dist/core/model-resolver.d.ts.map +1 -1
- package/dist/core/model-resolver.js +2 -0
- package/dist/core/model-resolver.js.map +1 -1
- package/dist/core/package-manager.d.ts +2 -0
- package/dist/core/package-manager.d.ts.map +1 -1
- package/dist/core/package-manager.js +22 -6
- package/dist/core/package-manager.js.map +1 -1
- package/dist/core/provider-display-names.d.ts.map +1 -1
- package/dist/core/provider-display-names.js +2 -0
- package/dist/core/provider-display-names.js.map +1 -1
- package/dist/modes/interactive/components/login-dialog.d.ts +0 -1
- package/dist/modes/interactive/components/login-dialog.d.ts.map +1 -1
- package/dist/modes/interactive/components/login-dialog.js +3 -12
- package/dist/modes/interactive/components/login-dialog.js.map +1 -1
- package/dist/self-update-bootstrap.d.ts +19 -0
- package/dist/self-update-bootstrap.d.ts.map +1 -0
- package/dist/self-update-bootstrap.js +160 -0
- package/dist/self-update-bootstrap.js.map +1 -0
- package/dist/senpi +46 -13
- package/dist/utils/git.d.ts.map +1 -1
- package/dist/utils/git.js +54 -22
- package/dist/utils/git.js.map +1 -1
- package/dist/utils/open-browser.d.ts +9 -0
- package/dist/utils/open-browser.d.ts.map +1 -0
- package/dist/utils/open-browser.js +22 -0
- package/dist/utils/open-browser.js.map +1 -0
- package/docs/containerization.md +111 -0
- package/docs/docs.json +4 -0
- package/docs/extensions.md +2 -0
- package/docs/index.md +1 -0
- package/docs/providers.md +3 -0
- package/examples/extensions/README.md +1 -0
- package/examples/extensions/gondolin/index.ts +531 -0
- package/examples/extensions/gondolin/package-lock.json +185 -0
- package/examples/extensions/gondolin/package.json +19 -0
- package/node_modules/@earendil-works/pi-agent-core/package.json +2 -2
- package/node_modules/@earendil-works/pi-ai/README.md +5 -1
- package/node_modules/@earendil-works/pi-ai/dist/env-api-keys.d.ts.map +1 -1
- package/node_modules/@earendil-works/pi-ai/dist/env-api-keys.js +2 -0
- package/node_modules/@earendil-works/pi-ai/dist/env-api-keys.js.map +1 -1
- package/node_modules/@earendil-works/pi-ai/dist/models.generated.d.ts +251 -48
- package/node_modules/@earendil-works/pi-ai/dist/models.generated.d.ts.map +1 -1
- package/node_modules/@earendil-works/pi-ai/dist/models.generated.js +208 -44
- package/node_modules/@earendil-works/pi-ai/dist/models.generated.js.map +1 -1
- package/node_modules/@earendil-works/pi-ai/dist/providers/openai-completions.d.ts.map +1 -1
- package/node_modules/@earendil-works/pi-ai/dist/providers/openai-completions.js +25 -8
- package/node_modules/@earendil-works/pi-ai/dist/providers/openai-completions.js.map +1 -1
- package/node_modules/@earendil-works/pi-ai/dist/types.d.ts +3 -3
- package/node_modules/@earendil-works/pi-ai/dist/types.d.ts.map +1 -1
- package/node_modules/@earendil-works/pi-ai/dist/types.js.map +1 -1
- package/node_modules/@earendil-works/pi-ai/dist/utils/oauth/github-copilot.d.ts.map +1 -1
- package/node_modules/@earendil-works/pi-ai/dist/utils/oauth/github-copilot.js +13 -1
- package/node_modules/@earendil-works/pi-ai/dist/utils/oauth/github-copilot.js.map +1 -1
- package/node_modules/@earendil-works/pi-ai/dist/utils/oauth/openai-codex.d.ts.map +1 -1
- package/node_modules/@earendil-works/pi-ai/dist/utils/oauth/openai-codex.js +4 -2
- package/node_modules/@earendil-works/pi-ai/dist/utils/oauth/openai-codex.js.map +1 -1
- package/node_modules/@earendil-works/pi-ai/package.json +1 -1
- package/node_modules/@earendil-works/pi-tui/package.json +1 -1
- package/npm-shrinkwrap.json +12 -12
- package/package.json +5 -4
package/dist/utils/git.js
CHANGED
|
@@ -56,6 +56,53 @@ function splitRef(url) {
|
|
|
56
56
|
ref,
|
|
57
57
|
};
|
|
58
58
|
}
|
|
59
|
+
function decodeForValidation(value) {
|
|
60
|
+
try {
|
|
61
|
+
return decodeURIComponent(value);
|
|
62
|
+
}
|
|
63
|
+
catch {
|
|
64
|
+
return null;
|
|
65
|
+
}
|
|
66
|
+
}
|
|
67
|
+
function hasUnsafeGitInstallPart(value, allowSlash) {
|
|
68
|
+
const decoded = decodeForValidation(value);
|
|
69
|
+
if (decoded === null) {
|
|
70
|
+
return true;
|
|
71
|
+
}
|
|
72
|
+
const candidates = [value, decoded];
|
|
73
|
+
for (const candidate of candidates) {
|
|
74
|
+
if (candidate.includes("\0") || candidate.includes("\\") || candidate.startsWith("/")) {
|
|
75
|
+
return true;
|
|
76
|
+
}
|
|
77
|
+
if (!allowSlash && candidate.includes("/")) {
|
|
78
|
+
return true;
|
|
79
|
+
}
|
|
80
|
+
if (candidate.split("/").includes("..")) {
|
|
81
|
+
return true;
|
|
82
|
+
}
|
|
83
|
+
}
|
|
84
|
+
return false;
|
|
85
|
+
}
|
|
86
|
+
function buildGitSource(args) {
|
|
87
|
+
if (args.path.startsWith("/")) {
|
|
88
|
+
return null;
|
|
89
|
+
}
|
|
90
|
+
const normalizedPath = args.path.replace(/\.git$/, "").replace(/^\/+/, "");
|
|
91
|
+
if (!args.host || !normalizedPath || normalizedPath.split("/").length < 2) {
|
|
92
|
+
return null;
|
|
93
|
+
}
|
|
94
|
+
if (hasUnsafeGitInstallPart(args.host, false) || hasUnsafeGitInstallPart(normalizedPath, true)) {
|
|
95
|
+
return null;
|
|
96
|
+
}
|
|
97
|
+
return {
|
|
98
|
+
type: "git",
|
|
99
|
+
repo: args.repo,
|
|
100
|
+
host: args.host,
|
|
101
|
+
path: normalizedPath,
|
|
102
|
+
ref: args.ref,
|
|
103
|
+
pinned: Boolean(args.ref),
|
|
104
|
+
};
|
|
105
|
+
}
|
|
59
106
|
function parseGenericGitUrl(url) {
|
|
60
107
|
const { repo: repoWithoutRef, ref } = splitRef(url);
|
|
61
108
|
let repo = repoWithoutRef;
|
|
@@ -91,18 +138,7 @@ function parseGenericGitUrl(url) {
|
|
|
91
138
|
}
|
|
92
139
|
repo = `https://${repoWithoutRef}`;
|
|
93
140
|
}
|
|
94
|
-
|
|
95
|
-
if (!host || !normalizedPath || normalizedPath.split("/").length < 2) {
|
|
96
|
-
return null;
|
|
97
|
-
}
|
|
98
|
-
return {
|
|
99
|
-
type: "git",
|
|
100
|
-
repo,
|
|
101
|
-
host,
|
|
102
|
-
path: normalizedPath,
|
|
103
|
-
ref,
|
|
104
|
-
pinned: Boolean(ref),
|
|
105
|
-
};
|
|
141
|
+
return buildGitSource({ repo, host, path, ref });
|
|
106
142
|
}
|
|
107
143
|
/**
|
|
108
144
|
* Parse git source into a GitSource.
|
|
@@ -131,14 +167,12 @@ export function parseGitUrl(source) {
|
|
|
131
167
|
!split.repo.startsWith("ssh://") &&
|
|
132
168
|
!split.repo.startsWith("git://") &&
|
|
133
169
|
!split.repo.startsWith("git@");
|
|
134
|
-
return {
|
|
135
|
-
type: "git",
|
|
170
|
+
return buildGitSource({
|
|
136
171
|
repo: useHttpsPrefix ? `https://${split.repo}` : split.repo,
|
|
137
172
|
host: info.domain || "",
|
|
138
|
-
path: `${info.user}/${info.project}
|
|
173
|
+
path: `${info.user}/${info.project}`,
|
|
139
174
|
ref: info.committish || split.ref || undefined,
|
|
140
|
-
|
|
141
|
-
};
|
|
175
|
+
});
|
|
142
176
|
}
|
|
143
177
|
}
|
|
144
178
|
const httpsCandidates = [split.ref ? `https://${split.repo}#${split.ref}` : undefined, `https://${url}`].filter((value) => Boolean(value));
|
|
@@ -148,14 +182,12 @@ export function parseGitUrl(source) {
|
|
|
148
182
|
if (split.ref && info.project?.includes("@")) {
|
|
149
183
|
continue;
|
|
150
184
|
}
|
|
151
|
-
return {
|
|
152
|
-
type: "git",
|
|
185
|
+
return buildGitSource({
|
|
153
186
|
repo: `https://${split.repo}`,
|
|
154
187
|
host: info.domain || "",
|
|
155
|
-
path: `${info.user}/${info.project}
|
|
188
|
+
path: `${info.user}/${info.project}`,
|
|
156
189
|
ref: info.committish || split.ref || undefined,
|
|
157
|
-
|
|
158
|
-
};
|
|
190
|
+
});
|
|
159
191
|
}
|
|
160
192
|
}
|
|
161
193
|
return parseGenericGitUrl(url);
|
package/dist/utils/git.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"git.js","sourceRoot":"","sources":["../../src/utils/git.ts"],"names":[],"mappings":"AAAA,OAAO,aAAa,MAAM,iBAAiB,CAAC;AAoB5C,SAAS,QAAQ,CAAC,GAAW,EAAkC;IAC9D,MAAM,YAAY,GAAG,GAAG,CAAC,KAAK,CAAC,oBAAoB,CAAC,CAAC;IACrD,IAAI,YAAY,EAAE,CAAC;QAClB,MAAM,gBAAgB,GAAG,YAAY,CAAC,CAAC,CAAC,IAAI,EAAE,CAAC;QAC/C,MAAM,YAAY,GAAG,gBAAgB,CAAC,OAAO,CAAC,GAAG,CAAC,CAAC;QACnD,IAAI,YAAY,GAAG,CAAC;YAAE,OAAO,EAAE,IAAI,EAAE,GAAG,EAAE,CAAC;QAC3C,MAAM,QAAQ,GAAG,gBAAgB,CAAC,KAAK,CAAC,CAAC,EAAE,YAAY,CAAC,CAAC;QACzD,MAAM,GAAG,GAAG,gBAAgB,CAAC,KAAK,CAAC,YAAY,GAAG,CAAC,CAAC,CAAC;QACrD,IAAI,CAAC,QAAQ,IAAI,CAAC,GAAG;YAAE,OAAO,EAAE,IAAI,EAAE,GAAG,EAAE,C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IAAI,EAAE,KAAK;gBACX,IAAI,EAAE,WAAW,KAAK,CAAC,IAAI,EAAE;gBAC7B,IAAI,EAAE,IAAI,CAAC,MAAM,IAAI,EAAE;gBACvB,IAAI,EAAE,GAAG,IAAI,CAAC,IAAI,IAAI,IAAI,CAAC,OAAO,EAAE,CAAC,OAAO,CAAC,QAAQ,EAAE,EAAE,CAAC;gBAC1D,GAAG,EAAE,IAAI,CAAC,UAAU,IAAI,KAAK,CAAC,GAAG,IAAI,SAAS;gBAC9C,MAAM,EAAE,OAAO,CAAC,IAAI,CAAC,UAAU,IAAI,KAAK,CAAC,GAAG,CAAC;aAC7C,CAAC;QACH,CAAC;IACF,CAAC;IAED,OAAO,kBAAkB,CAAC,GAAG,CAAC,CAAC;AAAA,CAC/B","sourcesContent":["import hostedGitInfo from \"hosted-git-info\";\n\n/**\n * Parsed git URL information.\n */\nexport type GitSource = {\n\t/** Always \"git\" for git sources */\n\ttype: \"git\";\n\t/** Clone URL (always valid for git clone, without ref suffix) */\n\trepo: string;\n\t/** Git host domain (e.g., \"github.com\") */\n\thost: string;\n\t/** Repository path (e.g., \"user/repo\") */\n\tpath: string;\n\t/** Git ref (branch, tag, commit) if specified */\n\tref?: string;\n\t/** True if ref was specified (package won't be auto-updated) */\n\tpinned: boolean;\n};\n\nfunction splitRef(url: string): { repo: string; ref?: string } {\n\tconst scpLikeMatch = url.match(/^git@([^:]+):(.+)$/);\n\tif (scpLikeMatch) {\n\t\tconst pathWithMaybeRef = scpLikeMatch[2] ?? \"\";\n\t\tconst refSeparator = pathWithMaybeRef.indexOf(\"@\");\n\t\tif (refSeparator < 0) return { repo: url };\n\t\tconst repoPath = pathWithMaybeRef.slice(0, refSeparator);\n\t\tconst ref = pathWithMaybeRef.slice(refSeparator + 1);\n\t\tif (!repoPath || !ref) return { repo: url };\n\t\treturn {\n\t\t\trepo: `git@${scpLikeMatch[1] ?? \"\"}:${repoPath}`,\n\t\t\tref,\n\t\t};\n\t}\n\n\tif (url.includes(\"://\")) {\n\t\ttry {\n\t\t\tconst parsed = new URL(url);\n\t\t\tconst pathWithMaybeRef = parsed.pathname.replace(/^\\/+/, \"\");\n\t\t\tconst refSeparator = pathWithMaybeRef.indexOf(\"@\");\n\t\t\tif (refSeparator < 0) return { repo: url };\n\t\t\tconst repoPath = pathWithMaybeRef.slice(0, refSeparator);\n\t\t\tconst ref = pathWithMaybeRef.slice(refSeparator + 1);\n\t\t\tif (!repoPath || !ref) return { repo: url };\n\t\t\tparsed.pathname = `/${repoPath}`;\n\t\t\treturn {\n\t\t\t\trepo: parsed.toString().replace(/\\/$/, \"\"),\n\t\t\t\tref,\n\t\t\t};\n\t\t} catch {\n\t\t\treturn { repo: url };\n\t\t}\n\t}\n\n\tconst slashIndex = url.indexOf(\"/\");\n\tif (slashIndex < 0) {\n\t\treturn { repo: url };\n\t}\n\tconst host = url.slice(0, slashIndex);\n\tconst pathWithMaybeRef = url.slice(slashIndex + 1);\n\tconst refSeparator = pathWithMaybeRef.indexOf(\"@\");\n\tif (refSeparator < 0) {\n\t\treturn { repo: url };\n\t}\n\tconst repoPath = pathWithMaybeRef.slice(0, refSeparator);\n\tconst ref = pathWithMaybeRef.slice(refSeparator + 1);\n\tif (!repoPath || !ref) {\n\t\treturn { repo: url };\n\t}\n\treturn {\n\t\trepo: `${host}/${repoPath}`,\n\t\tref,\n\t};\n}\n\nfunction parseGenericGitUrl(url: string): GitSource | null {\n\tconst { repo: repoWithoutRef, ref } = splitRef(url);\n\tlet repo = repoWithoutRef;\n\tlet host = \"\";\n\tlet path = \"\";\n\n\tconst scpLikeMatch = repoWithoutRef.match(/^git@([^:]+):(.+)$/);\n\tif (scpLikeMatch) {\n\t\thost = scpLikeMatch[1] ?? \"\";\n\t\tpath = scpLikeMatch[2] ?? \"\";\n\t} else if (\n\t\trepoWithoutRef.startsWith(\"https://\") ||\n\t\trepoWithoutRef.startsWith(\"http://\") ||\n\t\trepoWithoutRef.startsWith(\"ssh://\") ||\n\t\trepoWithoutRef.startsWith(\"git://\")\n\t) {\n\t\ttry {\n\t\t\tconst parsed = new URL(repoWithoutRef);\n\t\t\thost = parsed.hostname;\n\t\t\tpath = parsed.pathname.replace(/^\\/+/, \"\");\n\t\t} catch {\n\t\t\treturn null;\n\t\t}\n\t} else {\n\t\tconst slashIndex = repoWithoutRef.indexOf(\"/\");\n\t\tif (slashIndex < 0) {\n\t\t\treturn null;\n\t\t}\n\t\thost = repoWithoutRef.slice(0, slashIndex);\n\t\tpath = repoWithoutRef.slice(slashIndex + 1);\n\t\tif (!host.includes(\".\") && host !== \"localhost\") {\n\t\t\treturn null;\n\t\t}\n\t\trepo = `https://${repoWithoutRef}`;\n\t}\n\n\tconst normalizedPath = path.replace(/\\.git$/, \"\").replace(/^\\/+/, \"\");\n\tif (!host || !normalizedPath || normalizedPath.split(\"/\").length < 2) {\n\t\treturn null;\n\t}\n\n\treturn {\n\t\ttype: \"git\",\n\t\trepo,\n\t\thost,\n\t\tpath: normalizedPath,\n\t\tref,\n\t\tpinned: Boolean(ref),\n\t};\n}\n\n/**\n * Parse git source into a GitSource.\n *\n * Rules:\n * - With git: prefix, accept all historical shorthand forms.\n * - Without git: prefix, only accept explicit protocol URLs.\n */\nexport function parseGitUrl(source: string): GitSource | null {\n\tconst trimmed = source.trim();\n\tconst hasGitPrefix = trimmed.startsWith(\"git:\");\n\tconst url = hasGitPrefix ? trimmed.slice(4).trim() : trimmed;\n\n\tif (!hasGitPrefix && !/^(https?|ssh|git):\\/\\//i.test(url)) {\n\t\treturn null;\n\t}\n\n\tconst split = splitRef(url);\n\n\tconst hostedCandidates = [split.ref ? `${split.repo}#${split.ref}` : undefined, url].filter(\n\t\t(value): value is string => Boolean(value),\n\t);\n\tfor (const candidate of hostedCandidates) {\n\t\tconst info = hostedGitInfo.fromUrl(candidate);\n\t\tif (info) {\n\t\t\tif (split.ref && info.project?.includes(\"@\")) {\n\t\t\t\tcontinue;\n\t\t\t}\n\t\t\tconst useHttpsPrefix =\n\t\t\t\t!split.repo.startsWith(\"http://\") &&\n\t\t\t\t!split.repo.startsWith(\"https://\") &&\n\t\t\t\t!split.repo.startsWith(\"ssh://\") &&\n\t\t\t\t!split.repo.startsWith(\"git://\") &&\n\t\t\t\t!split.repo.startsWith(\"git@\");\n\t\t\treturn {\n\t\t\t\ttype: \"git\",\n\t\t\t\trepo: useHttpsPrefix ? `https://${split.repo}` : split.repo,\n\t\t\t\thost: info.domain || \"\",\n\t\t\t\tpath: `${info.user}/${info.project}`.replace(/\\.git$/, \"\"),\n\t\t\t\tref: info.committish || split.ref || undefined,\n\t\t\t\tpinned: Boolean(info.committish || split.ref),\n\t\t\t};\n\t\t}\n\t}\n\n\tconst httpsCandidates = [split.ref ? `https://${split.repo}#${split.ref}` : undefined, `https://${url}`].filter(\n\t\t(value): value is string => Boolean(value),\n\t);\n\tfor (const candidate of httpsCandidates) {\n\t\tconst info = hostedGitInfo.fromUrl(candidate);\n\t\tif (info) {\n\t\t\tif (split.ref && info.project?.includes(\"@\")) {\n\t\t\t\tcontinue;\n\t\t\t}\n\t\t\treturn {\n\t\t\t\ttype: \"git\",\n\t\t\t\trepo: `https://${split.repo}`,\n\t\t\t\thost: info.domain || \"\",\n\t\t\t\tpath: `${info.user}/${info.project}`.replace(/\\.git$/, \"\"),\n\t\t\t\tref: info.committish || split.ref || undefined,\n\t\t\t\tpinned: Boolean(info.committish || split.ref),\n\t\t\t};\n\t\t}\n\t}\n\n\treturn parseGenericGitUrl(url);\n}\n"]}
|
|
1
|
+
{"version":3,"file":"git.js","sourceRoot":"","sources":["../../src/utils/git.ts"],"names":[],"mappings":"AAAA,OAAO,aAAa,MAAM,iBAAiB,CAAC;AAoB5C,SAAS,QAAQ,CAAC,GAAW,EAAkC;IAC9D,MAAM,YAAY,GAAG,GAAG,CAAC,KAAK,CAAC,oBAAoB,CAAC,CAAC;IACrD,IAAI,YAAY,EAAE,CAAC;QAClB,MAAM,gBAAgB,GAAG,YAAY,CAAC,CAAC,CAAC,IAAI,EAAE,CA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,CAAC,WAAW,KAAK,CAAC,IAAI,IAAI,KAAK,CAAC,GAAG,EAAE,CAAC,CAAC,CAAC,SAAS,EAAE,WAAW,GAAG,EAAE,CAAC,CAAC,MAAM,CAC9G,CAAC,KAAK,EAAmB,EAAE,CAAC,OAAO,CAAC,KAAK,CAAC,CAC1C,CAAC;IACF,KAAK,MAAM,SAAS,IAAI,eAAe,EAAE,CAAC;QACzC,MAAM,IAAI,GAAG,aAAa,CAAC,OAAO,CAAC,SAAS,CAAC,CAAC;QAC9C,IAAI,IAAI,EAAE,CAAC;YACV,IAAI,KAAK,CAAC,GAAG,IAAI,IAAI,CAAC,OAAO,EAAE,QAAQ,CAAC,GAAG,CAAC,EAAE,CAAC;gBAC9C,SAAS;YACV,CAAC;YACD,OAAO,cAAc,CAAC;gBACrB,IAAI,EAAE,WAAW,KAAK,CAAC,IAAI,EAAE;gBAC7B,IAAI,EAAE,IAAI,CAAC,MAAM,IAAI,EAAE;gBACvB,IAAI,EAAE,GAAG,IAAI,CAAC,IAAI,IAAI,IAAI,CAAC,OAAO,EAAE;gBACpC,GAAG,EAAE,IAAI,CAAC,UAAU,IAAI,KAAK,CAAC,GAAG,IAAI,SAAS;aAC9C,CAAC,CAAC;QACJ,CAAC;IACF,CAAC;IAED,OAAO,kBAAkB,CAAC,GAAG,CAAC,CAAC;AAAA,CAC/B","sourcesContent":["import hostedGitInfo from \"hosted-git-info\";\n\n/**\n * Parsed git URL information.\n */\nexport type GitSource = {\n\t/** Always \"git\" for git sources */\n\ttype: \"git\";\n\t/** Clone URL (always valid for git clone, without ref suffix) */\n\trepo: string;\n\t/** Git host domain (e.g., \"github.com\") */\n\thost: string;\n\t/** Repository path (e.g., \"user/repo\") */\n\tpath: string;\n\t/** Git ref (branch, tag, commit) if specified */\n\tref?: string;\n\t/** True if ref was specified (package won't be auto-updated) */\n\tpinned: boolean;\n};\n\nfunction splitRef(url: string): { repo: string; ref?: string } {\n\tconst scpLikeMatch = url.match(/^git@([^:]+):(.+)$/);\n\tif (scpLikeMatch) {\n\t\tconst pathWithMaybeRef = scpLikeMatch[2] ?? \"\";\n\t\tconst refSeparator = pathWithMaybeRef.indexOf(\"@\");\n\t\tif (refSeparator < 0) return { repo: url };\n\t\tconst repoPath = pathWithMaybeRef.slice(0, refSeparator);\n\t\tconst ref = pathWithMaybeRef.slice(refSeparator + 1);\n\t\tif (!repoPath || !ref) return { repo: url };\n\t\treturn {\n\t\t\trepo: `git@${scpLikeMatch[1] ?? \"\"}:${repoPath}`,\n\t\t\tref,\n\t\t};\n\t}\n\n\tif (url.includes(\"://\")) {\n\t\ttry {\n\t\t\tconst parsed = new URL(url);\n\t\t\tconst pathWithMaybeRef = parsed.pathname.replace(/^\\/+/, \"\");\n\t\t\tconst refSeparator = pathWithMaybeRef.indexOf(\"@\");\n\t\t\tif (refSeparator < 0) return { repo: url };\n\t\t\tconst repoPath = pathWithMaybeRef.slice(0, refSeparator);\n\t\t\tconst ref = pathWithMaybeRef.slice(refSeparator + 1);\n\t\t\tif (!repoPath || !ref) return { repo: url };\n\t\t\tparsed.pathname = `/${repoPath}`;\n\t\t\treturn {\n\t\t\t\trepo: parsed.toString().replace(/\\/$/, \"\"),\n\t\t\t\tref,\n\t\t\t};\n\t\t} catch {\n\t\t\treturn { repo: url };\n\t\t}\n\t}\n\n\tconst slashIndex = url.indexOf(\"/\");\n\tif (slashIndex < 0) {\n\t\treturn { repo: url };\n\t}\n\tconst host = url.slice(0, slashIndex);\n\tconst pathWithMaybeRef = url.slice(slashIndex + 1);\n\tconst refSeparator = pathWithMaybeRef.indexOf(\"@\");\n\tif (refSeparator < 0) {\n\t\treturn { repo: url };\n\t}\n\tconst repoPath = pathWithMaybeRef.slice(0, refSeparator);\n\tconst ref = pathWithMaybeRef.slice(refSeparator + 1);\n\tif (!repoPath || !ref) {\n\t\treturn { repo: url };\n\t}\n\treturn {\n\t\trepo: `${host}/${repoPath}`,\n\t\tref,\n\t};\n}\n\nfunction decodeForValidation(value: string): string | null {\n\ttry {\n\t\treturn decodeURIComponent(value);\n\t} catch {\n\t\treturn null;\n\t}\n}\n\nfunction hasUnsafeGitInstallPart(value: string, allowSlash: boolean): boolean {\n\tconst decoded = decodeForValidation(value);\n\tif (decoded === null) {\n\t\treturn true;\n\t}\n\tconst candidates = [value, decoded];\n\tfor (const candidate of candidates) {\n\t\tif (candidate.includes(\"\\0\") || candidate.includes(\"\\\\\") || candidate.startsWith(\"/\")) {\n\t\t\treturn true;\n\t\t}\n\t\tif (!allowSlash && candidate.includes(\"/\")) {\n\t\t\treturn true;\n\t\t}\n\t\tif (candidate.split(\"/\").includes(\"..\")) {\n\t\t\treturn true;\n\t\t}\n\t}\n\treturn false;\n}\n\nfunction buildGitSource(args: { repo: string; host: string; path: string; ref?: string }): GitSource | null {\n\tif (args.path.startsWith(\"/\")) {\n\t\treturn null;\n\t}\n\tconst normalizedPath = args.path.replace(/\\.git$/, \"\").replace(/^\\/+/, \"\");\n\tif (!args.host || !normalizedPath || normalizedPath.split(\"/\").length < 2) {\n\t\treturn null;\n\t}\n\tif (hasUnsafeGitInstallPart(args.host, false) || hasUnsafeGitInstallPart(normalizedPath, true)) {\n\t\treturn null;\n\t}\n\n\treturn {\n\t\ttype: \"git\",\n\t\trepo: args.repo,\n\t\thost: args.host,\n\t\tpath: normalizedPath,\n\t\tref: args.ref,\n\t\tpinned: Boolean(args.ref),\n\t};\n}\n\nfunction parseGenericGitUrl(url: string): GitSource | null {\n\tconst { repo: repoWithoutRef, ref } = splitRef(url);\n\tlet repo = repoWithoutRef;\n\tlet host = \"\";\n\tlet path = \"\";\n\n\tconst scpLikeMatch = repoWithoutRef.match(/^git@([^:]+):(.+)$/);\n\tif (scpLikeMatch) {\n\t\thost = scpLikeMatch[1] ?? \"\";\n\t\tpath = scpLikeMatch[2] ?? \"\";\n\t} else if (\n\t\trepoWithoutRef.startsWith(\"https://\") ||\n\t\trepoWithoutRef.startsWith(\"http://\") ||\n\t\trepoWithoutRef.startsWith(\"ssh://\") ||\n\t\trepoWithoutRef.startsWith(\"git://\")\n\t) {\n\t\ttry {\n\t\t\tconst parsed = new URL(repoWithoutRef);\n\t\t\thost = parsed.hostname;\n\t\t\tpath = parsed.pathname.replace(/^\\/+/, \"\");\n\t\t} catch {\n\t\t\treturn null;\n\t\t}\n\t} else {\n\t\tconst slashIndex = repoWithoutRef.indexOf(\"/\");\n\t\tif (slashIndex < 0) {\n\t\t\treturn null;\n\t\t}\n\t\thost = repoWithoutRef.slice(0, slashIndex);\n\t\tpath = repoWithoutRef.slice(slashIndex + 1);\n\t\tif (!host.includes(\".\") && host !== \"localhost\") {\n\t\t\treturn null;\n\t\t}\n\t\trepo = `https://${repoWithoutRef}`;\n\t}\n\n\treturn buildGitSource({ repo, host, path, ref });\n}\n\n/**\n * Parse git source into a GitSource.\n *\n * Rules:\n * - With git: prefix, accept all historical shorthand forms.\n * - Without git: prefix, only accept explicit protocol URLs.\n */\nexport function parseGitUrl(source: string): GitSource | null {\n\tconst trimmed = source.trim();\n\tconst hasGitPrefix = trimmed.startsWith(\"git:\");\n\tconst url = hasGitPrefix ? trimmed.slice(4).trim() : trimmed;\n\n\tif (!hasGitPrefix && !/^(https?|ssh|git):\\/\\//i.test(url)) {\n\t\treturn null;\n\t}\n\n\tconst split = splitRef(url);\n\n\tconst hostedCandidates = [split.ref ? `${split.repo}#${split.ref}` : undefined, url].filter(\n\t\t(value): value is string => Boolean(value),\n\t);\n\tfor (const candidate of hostedCandidates) {\n\t\tconst info = hostedGitInfo.fromUrl(candidate);\n\t\tif (info) {\n\t\t\tif (split.ref && info.project?.includes(\"@\")) {\n\t\t\t\tcontinue;\n\t\t\t}\n\t\t\tconst useHttpsPrefix =\n\t\t\t\t!split.repo.startsWith(\"http://\") &&\n\t\t\t\t!split.repo.startsWith(\"https://\") &&\n\t\t\t\t!split.repo.startsWith(\"ssh://\") &&\n\t\t\t\t!split.repo.startsWith(\"git://\") &&\n\t\t\t\t!split.repo.startsWith(\"git@\");\n\t\t\treturn buildGitSource({\n\t\t\t\trepo: useHttpsPrefix ? `https://${split.repo}` : split.repo,\n\t\t\t\thost: info.domain || \"\",\n\t\t\t\tpath: `${info.user}/${info.project}`,\n\t\t\t\tref: info.committish || split.ref || undefined,\n\t\t\t});\n\t\t}\n\t}\n\n\tconst httpsCandidates = [split.ref ? `https://${split.repo}#${split.ref}` : undefined, `https://${url}`].filter(\n\t\t(value): value is string => Boolean(value),\n\t);\n\tfor (const candidate of httpsCandidates) {\n\t\tconst info = hostedGitInfo.fromUrl(candidate);\n\t\tif (info) {\n\t\t\tif (split.ref && info.project?.includes(\"@\")) {\n\t\t\t\tcontinue;\n\t\t\t}\n\t\t\treturn buildGitSource({\n\t\t\t\trepo: `https://${split.repo}`,\n\t\t\t\thost: info.domain || \"\",\n\t\t\t\tpath: `${info.user}/${info.project}`,\n\t\t\t\tref: info.committish || split.ref || undefined,\n\t\t\t});\n\t\t}\n\t}\n\n\treturn parseGenericGitUrl(url);\n}\n"]}
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Open a URL or file in the platform browser/default handler.
|
|
3
|
+
*
|
|
4
|
+
* This intentionally never invokes a shell. On Windows, do not use
|
|
5
|
+
* `cmd /c start`: cmd.exe re-parses metacharacters (&, |, ^, ...) before
|
|
6
|
+
* `start` runs, which would make attacker-controlled URLs injectable.
|
|
7
|
+
*/
|
|
8
|
+
export declare function openBrowser(target: string): void;
|
|
9
|
+
//# sourceMappingURL=open-browser.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"open-browser.d.ts","sourceRoot":"","sources":["../../src/utils/open-browser.ts"],"names":[],"mappings":"AAEA;;;;;;GAMG;AACH,wBAAgB,WAAW,CAAC,MAAM,EAAE,MAAM,GAAG,IAAI,CAchD","sourcesContent":["import { spawn } from \"node:child_process\";\n\n/**\n * Open a URL or file in the platform browser/default handler.\n *\n * This intentionally never invokes a shell. On Windows, do not use\n * `cmd /c start`: cmd.exe re-parses metacharacters (&, |, ^, ...) before\n * `start` runs, which would make attacker-controlled URLs injectable.\n */\nexport function openBrowser(target: string): void {\n\tconst [cmd, args]: [string, string[]] =\n\t\tprocess.platform === \"darwin\"\n\t\t\t? [\"open\", [target]]\n\t\t\t: process.platform === \"win32\"\n\t\t\t\t? [\"rundll32\", [\"url.dll,FileProtocolHandler\", target]]\n\t\t\t\t: [\"xdg-open\", [target]];\n\n\t// spawn reports launcher failures (for example, missing xdg-open) via an\n\t// error event. Browser launch is best-effort: callers still present the target\n\t// to the user, so keep the launcher failure from becoming a process crash.\n\tspawn(cmd, args, { stdio: \"ignore\", detached: true })\n\t\t.on(\"error\", () => {})\n\t\t.unref();\n}\n"]}
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
import { spawn } from "node:child_process";
|
|
2
|
+
/**
|
|
3
|
+
* Open a URL or file in the platform browser/default handler.
|
|
4
|
+
*
|
|
5
|
+
* This intentionally never invokes a shell. On Windows, do not use
|
|
6
|
+
* `cmd /c start`: cmd.exe re-parses metacharacters (&, |, ^, ...) before
|
|
7
|
+
* `start` runs, which would make attacker-controlled URLs injectable.
|
|
8
|
+
*/
|
|
9
|
+
export function openBrowser(target) {
|
|
10
|
+
const [cmd, args] = process.platform === "darwin"
|
|
11
|
+
? ["open", [target]]
|
|
12
|
+
: process.platform === "win32"
|
|
13
|
+
? ["rundll32", ["url.dll,FileProtocolHandler", target]]
|
|
14
|
+
: ["xdg-open", [target]];
|
|
15
|
+
// spawn reports launcher failures (for example, missing xdg-open) via an
|
|
16
|
+
// error event. Browser launch is best-effort: callers still present the target
|
|
17
|
+
// to the user, so keep the launcher failure from becoming a process crash.
|
|
18
|
+
spawn(cmd, args, { stdio: "ignore", detached: true })
|
|
19
|
+
.on("error", () => { })
|
|
20
|
+
.unref();
|
|
21
|
+
}
|
|
22
|
+
//# sourceMappingURL=open-browser.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"open-browser.js","sourceRoot":"","sources":["../../src/utils/open-browser.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,KAAK,EAAE,MAAM,oBAAoB,CAAC;AAE3C;;;;;;GAMG;AACH,MAAM,UAAU,WAAW,CAAC,MAAc,EAAQ;IACjD,MAAM,CAAC,GAAG,EAAE,IAAI,CAAC,GAChB,OAAO,CAAC,QAAQ,KAAK,QAAQ;QAC5B,CAAC,CAAC,CAAC,MAAM,EAAE,CAAC,MAAM,CAAC,CAAC;QACpB,CAAC,CAAC,OAAO,CAAC,QAAQ,KAAK,OAAO;YAC7B,CAAC,CAAC,CAAC,UAAU,EAAE,CAAC,6BAA6B,EAAE,MAAM,CAAC,CAAC;YACvD,CAAC,CAAC,CAAC,UAAU,EAAE,CAAC,MAAM,CAAC,CAAC,CAAC;IAE5B,yEAAyE;IACzE,+EAA+E;IAC/E,2EAA2E;IAC3E,KAAK,CAAC,GAAG,EAAE,IAAI,EAAE,EAAE,KAAK,EAAE,QAAQ,EAAE,QAAQ,EAAE,IAAI,EAAE,CAAC;SACnD,EAAE,CAAC,OAAO,EAAE,GAAG,EAAE,CAAC,EAAC,CAAC,CAAC;SACrB,KAAK,EAAE,CAAC;AAAA,CACV","sourcesContent":["import { spawn } from \"node:child_process\";\n\n/**\n * Open a URL or file in the platform browser/default handler.\n *\n * This intentionally never invokes a shell. On Windows, do not use\n * `cmd /c start`: cmd.exe re-parses metacharacters (&, |, ^, ...) before\n * `start` runs, which would make attacker-controlled URLs injectable.\n */\nexport function openBrowser(target: string): void {\n\tconst [cmd, args]: [string, string[]] =\n\t\tprocess.platform === \"darwin\"\n\t\t\t? [\"open\", [target]]\n\t\t\t: process.platform === \"win32\"\n\t\t\t\t? [\"rundll32\", [\"url.dll,FileProtocolHandler\", target]]\n\t\t\t\t: [\"xdg-open\", [target]];\n\n\t// spawn reports launcher failures (for example, missing xdg-open) via an\n\t// error event. Browser launch is best-effort: callers still present the target\n\t// to the user, so keep the launcher failure from becoming a process crash.\n\tspawn(cmd, args, { stdio: \"ignore\", detached: true })\n\t\t.on(\"error\", () => {})\n\t\t.unref();\n}\n"]}
|
|
@@ -0,0 +1,111 @@
|
|
|
1
|
+
# Containerization
|
|
2
|
+
|
|
3
|
+
Pi runs with all permissions by default, but in some cases, you will want to have more control over what directories Pi can write to and which accesses it has.
|
|
4
|
+
|
|
5
|
+
There are two general options. You can either
|
|
6
|
+
1. run the whole `pi` process inside an isolated environment, or
|
|
7
|
+
2. run `pi` on the host and route tool execution into an isolated environment.
|
|
8
|
+
|
|
9
|
+
## Choose a pattern
|
|
10
|
+
|
|
11
|
+
| Pattern | What is isolated | Best for | Notes |
|
|
12
|
+
| --- | --- | --- | --- |
|
|
13
|
+
| OpenShell | Whole `pi` process in a policy-controlled sandbox | Local or remote managed sandbox | Requires an OpenShell gateway |
|
|
14
|
+
| Gondolin extension | Built-in tools and `!` commands | Local micro-VM isolation while keeping auth on host | See [`examples/extensions/gondolin/`](../examples/extensions/gondolin/). |
|
|
15
|
+
| Plain Docker | Whole `pi` process in a local container | Simple local isolation | Provider API keys enter the container. |
|
|
16
|
+
|
|
17
|
+
Extensions run wherever the `pi` process runs. If you run host `pi` with a tool-routing extension, other custom extension tools still run on the host unless they also delegate their operations.
|
|
18
|
+
|
|
19
|
+
## OpenShell
|
|
20
|
+
|
|
21
|
+
Use [NVIDIA OpenShell](https://docs.nvidia.com/openshell/about/overview) when you want a policy-controlled sandbox with filesystem, process, network, credential, and inference controls.
|
|
22
|
+
OpenShell can run sandboxes through a local gateway backed by Docker, Podman, or a VM runtime, or through a remote Kubernetes gateway.
|
|
23
|
+
|
|
24
|
+
Every sandbox requires an active gateway.
|
|
25
|
+
Register and select one before creating a sandbox:
|
|
26
|
+
|
|
27
|
+
```bash
|
|
28
|
+
openshell gateway add <gateway-url> --name <name>
|
|
29
|
+
openshell gateway select <name>
|
|
30
|
+
```
|
|
31
|
+
|
|
32
|
+
Launch `pi` inside an OpenShell sandbox:
|
|
33
|
+
|
|
34
|
+
```bash
|
|
35
|
+
openshell sandbox create --name pi-sandbox --from pi -- pi
|
|
36
|
+
```
|
|
37
|
+
|
|
38
|
+
In this pattern, the whole `pi` process runs inside the sandbox.
|
|
39
|
+
Built-in tools, `!` commands, and extension tools execute inside the OpenShell boundary.
|
|
40
|
+
|
|
41
|
+
If the gateway is remote, project files are not bind-mounted from the host, meaning writes in the sandbox are not reflected on your machine.
|
|
42
|
+
Clone the repository inside the sandbox or use OpenShell file transfer commands:
|
|
43
|
+
|
|
44
|
+
```bash
|
|
45
|
+
openshell sandbox upload pi-sandbox ./repo /workspace
|
|
46
|
+
openshell sandbox download pi-sandbox /workspace/repo ./repo-out
|
|
47
|
+
```
|
|
48
|
+
|
|
49
|
+
OpenShell providers can keep raw model API keys outside the sandbox.
|
|
50
|
+
When inference routing is configured, code inside the sandbox can call `https://inference.local`, and the gateway injects the configured provider credentials upstream.
|
|
51
|
+
Configure Pi to use the corresponding OpenAI-compatible or Anthropic-compatible endpoint if you want model traffic to use this route.
|
|
52
|
+
|
|
53
|
+
## Gondolin
|
|
54
|
+
|
|
55
|
+
[Gondolin](https://github.com/earendil-works/gondolin) is a local Linux micro-VM.
|
|
56
|
+
Use the [example extension](../examples/extensions/gondolin) when you want `pi` on the host but all built-in tools routed into the VM.
|
|
57
|
+
|
|
58
|
+
Setup:
|
|
59
|
+
|
|
60
|
+
```bash
|
|
61
|
+
cp -R packages/coding-agent/examples/extensions/gondolin ~/.pi/agent/extensions/gondolin
|
|
62
|
+
cd ~/.pi/agent/extensions/gondolin
|
|
63
|
+
npm install --ignore-scripts
|
|
64
|
+
```
|
|
65
|
+
|
|
66
|
+
Run from the project you want mounted:
|
|
67
|
+
|
|
68
|
+
```bash
|
|
69
|
+
cd /path/to/project
|
|
70
|
+
pi -e ~/.pi/agent/extensions/gondolin
|
|
71
|
+
```
|
|
72
|
+
|
|
73
|
+
The extension mounts the host cwd at `/workspace` in the VM and overrides `read`, `write`, `edit`, `bash`, `grep`, `find`, and `ls`.
|
|
74
|
+
User `!` commands are routed into the VM, as well.
|
|
75
|
+
File changes under `/workspace` write through to the host.
|
|
76
|
+
|
|
77
|
+
Requirements: Node.js >= 23.6.0 for `@earendil-works/gondolin`, plus QEMU (requires installation through your package manager).
|
|
78
|
+
|
|
79
|
+
## Plain Docker
|
|
80
|
+
|
|
81
|
+
Run the whole `pi` process in Docker when you want the simplest local container boundary.
|
|
82
|
+
|
|
83
|
+
`Dockerfile.pi`:
|
|
84
|
+
|
|
85
|
+
```dockerfile
|
|
86
|
+
FROM node:24-bookworm-slim
|
|
87
|
+
|
|
88
|
+
RUN apt-get update \
|
|
89
|
+
&& apt-get install -y --no-install-recommends bash ca-certificates git ripgrep \
|
|
90
|
+
&& rm -rf /var/lib/apt/lists/*
|
|
91
|
+
RUN npm install -g --ignore-scripts @earendil-works/pi-coding-agent
|
|
92
|
+
|
|
93
|
+
WORKDIR /workspace
|
|
94
|
+
ENTRYPOINT ["pi"]
|
|
95
|
+
```
|
|
96
|
+
|
|
97
|
+
Build and run:
|
|
98
|
+
|
|
99
|
+
```bash
|
|
100
|
+
docker build -t pi-sandbox -f Dockerfile.pi .
|
|
101
|
+
|
|
102
|
+
docker run --rm -it \
|
|
103
|
+
-e ANTHROPIC_API_KEY \
|
|
104
|
+
-v "$PWD:/workspace" \
|
|
105
|
+
-v pi-agent-home:/root/.pi/agent \
|
|
106
|
+
pi-sandbox
|
|
107
|
+
```
|
|
108
|
+
|
|
109
|
+
The `-v "$PWD:/workspace"` mounts your current directory into the container at /workspace such that reads and writes in `/workspace` inside Docker directly affect your host files, like in the Gondolin example.
|
|
110
|
+
|
|
111
|
+
Use a named volume for `/root/.pi/agent` if you want container-local settings and sessions. Mounting your host `~/.pi/agent` exposes host auth and session files to the container.
|
package/docs/docs.json
CHANGED
package/docs/extensions.md
CHANGED
|
@@ -2606,6 +2606,8 @@ All examples in [examples/extensions/](../examples/extensions/).
|
|
|
2606
2606
|
| `ssh.ts` | SSH remote execution | `registerFlag`, `on("user_bash")`, `on("before_agent_start")`, tool operations |
|
|
2607
2607
|
| `interactive-shell.ts` | Persistent shell session | `on("user_bash")` |
|
|
2608
2608
|
| `sandbox/` | Sandboxed tool execution | Tool operations |
|
|
2609
|
+
| `gondolin/` | Route built-in tools and `!` commands into a Gondolin micro-VM | Tool operations, built-in tool overrides, `on("user_bash")` |
|
|
2610
|
+
| `subagent/` | Spawn sub-agents | `registerTool`, `exec` |
|
|
2609
2611
|
| **Games** |||
|
|
2610
2612
|
| `snake.ts` | Snake game | `registerCommand`, `ui.custom`, keyboard handling |
|
|
2611
2613
|
| `space-invaders.ts` | Space Invaders game | `registerCommand`, `ui.custom` |
|
package/docs/index.md
CHANGED
|
@@ -33,6 +33,7 @@ For the full first-run flow, see [Quickstart](quickstart.md).
|
|
|
33
33
|
- [Quickstart](quickstart.md) - install, authenticate, and run a first session.
|
|
34
34
|
- [Using Senpi](usage.md) - interactive mode, slash commands, context files, and CLI reference.
|
|
35
35
|
- [Providers](providers.md) - subscription and API-key setup for built-in providers.
|
|
36
|
+
- [Containerization](containerization.md) - sandbox pi with OpenShell, Gondolin, or Docker.
|
|
36
37
|
- [Settings](settings.md) - global and project settings.
|
|
37
38
|
- [Keybindings](keybindings.md) - default shortcuts and custom keybindings.
|
|
38
39
|
- [Sessions](sessions.md) - session management, branching, and tree navigation.
|
package/docs/providers.md
CHANGED
|
@@ -49,6 +49,7 @@ pi
|
|
|
49
49
|
| Provider | Environment Variable | `auth.json` key |
|
|
50
50
|
|----------|----------------------|------------------|
|
|
51
51
|
| Anthropic | `ANTHROPIC_API_KEY` | `anthropic` |
|
|
52
|
+
| Ant Ling | `ANT_LING_API_KEY` | `ant-ling` |
|
|
52
53
|
| Azure OpenAI Responses | `AZURE_OPENAI_API_KEY` | `azure-openai-responses` |
|
|
53
54
|
| OpenAI | `OPENAI_API_KEY` | `openai` |
|
|
54
55
|
| DeepSeek | `DEEPSEEK_API_KEY` | `deepseek` |
|
|
@@ -63,6 +64,7 @@ pi
|
|
|
63
64
|
| OpenRouter | `OPENROUTER_API_KEY` | `openrouter` |
|
|
64
65
|
| Vercel AI Gateway | `AI_GATEWAY_API_KEY` | `vercel-ai-gateway` |
|
|
65
66
|
| ZAI | `ZAI_API_KEY` | `zai` |
|
|
67
|
+
| ZAI Coding Plan (China) | `ZAI_CODING_CN_API_KEY` | `zai-coding-cn` |
|
|
66
68
|
| OpenCode Zen | `OPENCODE_API_KEY` | `opencode` |
|
|
67
69
|
| OpenCode Go | `OPENCODE_API_KEY` | `opencode-go` |
|
|
68
70
|
| Hugging Face | `HF_TOKEN` | `huggingface` |
|
|
@@ -85,6 +87,7 @@ Store credentials in `~/.senpi/agent/auth.json`:
|
|
|
85
87
|
```json
|
|
86
88
|
{
|
|
87
89
|
"anthropic": { "type": "api_key", "key": "sk-ant-..." },
|
|
90
|
+
"ant-ling": { "type": "api_key", "key": "..." },
|
|
88
91
|
"openai": { "type": "api_key", "key": "sk-..." },
|
|
89
92
|
"deepseek": { "type": "api_key", "key": "sk-..." },
|
|
90
93
|
"nvidia": { "type": "api_key", "key": "nvapi-..." },
|
|
@@ -23,6 +23,7 @@ cp permission-gate.ts ~/.senpi/agent/extensions/
|
|
|
23
23
|
| `confirm-destructive.ts` | Confirms before destructive session actions (clear, switch, fork) |
|
|
24
24
|
| `dirty-repo-guard.ts` | Prevents session changes with uncommitted git changes |
|
|
25
25
|
| `sandbox/` | OS-level sandboxing using `@anthropic-ai/sandbox-runtime` with per-project config |
|
|
26
|
+
| `gondolin/` | Route built-in tools and `!` commands into a Gondolin micro-VM |
|
|
26
27
|
|
|
27
28
|
### Custom Tools
|
|
28
29
|
|