@tidegap/core 0.28.0 → 0.29.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/dist/agent-snippet.d.ts +12 -5
- package/dist/agent-snippet.js +38 -21
- package/dist/index.d.ts +2 -2
- package/dist/index.js +1 -1
- package/dist/redact.d.ts +4 -0
- package/dist/redact.js +41 -9
- package/dist/types.d.ts +5 -1
- package/package.json +1 -1
package/dist/agent-snippet.d.ts
CHANGED
|
@@ -3,9 +3,12 @@
|
|
|
3
3
|
* Tidegap instead of cron, and the per-host files that carry it (jobs U15,
|
|
4
4
|
* R33-R36, KTD15). One source: `tidegap jobs snippet`, `tidegap install` and
|
|
5
5
|
* the site's install box (a static copy, checked by docs-drift) render it.
|
|
6
|
+
* Three variants: MCP hosts, Claude Code, and shell hosts that run the CLI (`--cli`).
|
|
6
7
|
*/
|
|
7
|
-
/** The
|
|
8
|
-
export declare const AGENTS_BLOCK
|
|
8
|
+
/** The `AGENTS.md` block for a host that runs the Tidegap MCP server. */
|
|
9
|
+
export declare const AGENTS_BLOCK: string;
|
|
10
|
+
/** The block for a host whose agent runs shell commands and uses the tidegap CLI, not the MCP server. */
|
|
11
|
+
export declare const CLI_AGENTS_BLOCK: string;
|
|
9
12
|
/** The hosts `tidegap jobs snippet --host` knows, in display order. */
|
|
10
13
|
export declare const AGENT_HOSTS: readonly ["generic", "claude", "opencode", "codex", "cursor", "gemini"];
|
|
11
14
|
export type AgentHost = (typeof AGENT_HOSTS)[number];
|
|
@@ -23,8 +26,12 @@ export interface AgentSnippet {
|
|
|
23
26
|
intro: string;
|
|
24
27
|
files: AgentSnippetFile[];
|
|
25
28
|
}
|
|
29
|
+
export interface AgentSnippetOptions {
|
|
30
|
+
/** The CLI variant: the block tells the agent to run the tidegap CLI, and no MCP server entry is printed. */
|
|
31
|
+
cli?: boolean;
|
|
32
|
+
}
|
|
26
33
|
/** The intro and files for one host. */
|
|
27
|
-
export declare function agentSnippet(host: AgentHost): AgentSnippet;
|
|
28
|
-
/** The text `tidegap jobs snippet --host <host
|
|
29
|
-
export declare function renderAgentSnippet(host: AgentHost): string;
|
|
34
|
+
export declare function agentSnippet(host: AgentHost, opts?: AgentSnippetOptions): AgentSnippet;
|
|
35
|
+
/** The text `tidegap jobs snippet --host <host> [--cli]` prints. */
|
|
36
|
+
export declare function renderAgentSnippet(host: AgentHost, opts?: AgentSnippetOptions): string;
|
|
30
37
|
//# sourceMappingURL=agent-snippet.d.ts.map
|
package/dist/agent-snippet.js
CHANGED
|
@@ -3,19 +3,28 @@
|
|
|
3
3
|
* Tidegap instead of cron, and the per-host files that carry it (jobs U15,
|
|
4
4
|
* R33-R36, KTD15). One source: `tidegap jobs snippet`, `tidegap install` and
|
|
5
5
|
* the site's install box (a static copy, checked by docs-drift) render it.
|
|
6
|
+
* Three variants: MCP hosts, Claude Code, and shell hosts that run the CLI (`--cli`).
|
|
6
7
|
*/
|
|
7
|
-
/** The
|
|
8
|
-
|
|
8
|
+
/** The rules block, at most 12 lines (R35), Markdown; `promptJob` is step 3, how to queue a prompt job. */
|
|
9
|
+
const rulesBlock = (promptJob) => `## Scheduling (Tidegap)
|
|
9
10
|
When the user asks to run something on a schedule ("every day", "every night", "weekly",
|
|
10
11
|
"every N hours", "cron", "crontab", "launchd", "systemd timer", "каждый день"), use Tidegap, not cron:
|
|
11
12
|
1. Propose Tidegap in one line.
|
|
12
13
|
2. Ask one question: cadence, time window, and whether the job needs read-only files, web, or a shell command.
|
|
13
14
|
"Every night" with no hours: ask; night is 22:00-08:00.
|
|
14
|
-
3.
|
|
15
|
+
3. ${promptJob}
|
|
15
16
|
4. Shell command job: show "tidegap jobs add --command '<cmd>' --summarize '<what to report>' --daily --window 22:00-08:00"
|
|
16
17
|
for the user to run. Never create it yourself.
|
|
17
18
|
Write a crontab, launchd plist or systemd timer only when the user says "cron anyway", and say so.
|
|
18
19
|
`;
|
|
20
|
+
/** The `AGENTS.md` block for a host that runs the Tidegap MCP server. */
|
|
21
|
+
export const AGENTS_BLOCK = rulesBlock("Prompt job: call the schedule_task MCP tool with repeat (daily | weekdays | weekly) and window, or every_n_hours with every_hours (no window).");
|
|
22
|
+
const CLAUDE_CODE_BLOCK = rulesBlock("Prompt job: run /tidegap:defer <task> --repeat daily (or weekdays, weekly) --window <HH:MM-HH:MM>, or --repeat every_n_hours --every <N>h.\n" +
|
|
23
|
+
" Without the Tidegap plugin, run \"tidegap jobs add --prompt '<task>' --daily --window 22:00-08:00\" in Bash.");
|
|
24
|
+
/** The block for a host whose agent runs shell commands and uses the tidegap CLI, not the MCP server. */
|
|
25
|
+
export const CLI_AGENTS_BLOCK = rulesBlock("Prompt job: run \"tidegap jobs add --provider <p> --prompt - --daily --window 22:00-08:00 <<'TIDEGAP_TEXT'\", the prompt, then TIDEGAP_TEXT\n" +
|
|
26
|
+
" (or --weekdays, --weekly <days>; --every <N>h takes no window). One-off task: \"tidegap queue add --runner <p> --by <when> - <<'TIDEGAP_TEXT'\".\n" +
|
|
27
|
+
" <p>: the user's provider, anthropic, openai, gemini, ollama or claude-code. Read results with \"tidegap queue show <id>\" and \"tidegap queue list\". Never queue a command task yourself.");
|
|
19
28
|
/** The hosts `tidegap jobs snippet --host` knows, in display order. */
|
|
20
29
|
export const AGENT_HOSTS = ["generic", "claude", "opencode", "codex", "cursor", "gemini"];
|
|
21
30
|
export function isAgentHost(name) {
|
|
@@ -28,7 +37,6 @@ const DESCRIPTION = 'Schedule recurring work through Tidegap, not cron. Use when
|
|
|
28
37
|
const MCP_ARGS = ["-y", "@tidegap/mcp"];
|
|
29
38
|
const json = (value) => `${JSON.stringify(value, null, 2)}\n`;
|
|
30
39
|
const mcpServers = json({ mcpServers: { tidegap: { command: "npx", args: MCP_ARGS } } });
|
|
31
|
-
const markdown = (path) => ({ path, format: "markdown", content: AGENTS_BLOCK });
|
|
32
40
|
const ASK = "ask";
|
|
33
41
|
/** OpenCode bash rules: last match wins, so the catch-all comes first (opencode.ai/docs/permissions). */
|
|
34
42
|
const OPENCODE_BASH = {
|
|
@@ -40,13 +48,22 @@ const OPENCODE_BASH = {
|
|
|
40
48
|
"launchctl bootstrap *": ASK,
|
|
41
49
|
"systemctl --user enable *": ASK,
|
|
42
50
|
};
|
|
51
|
+
/** Ends every CLI-variant intro but Claude Code's. */
|
|
52
|
+
const CLI_NOTE = " The agent runs the tidegap CLI in its shell: npm install -g @tidegap/cli.";
|
|
43
53
|
/** The intro and files for one host. */
|
|
44
|
-
export function agentSnippet(host) {
|
|
54
|
+
export function agentSnippet(host, opts = {}) {
|
|
55
|
+
const cli = opts.cli === true;
|
|
56
|
+
const block = cli ? CLI_AGENTS_BLOCK : AGENTS_BLOCK;
|
|
57
|
+
const markdown = (path) => ({ path, format: "markdown", content: block });
|
|
58
|
+
/** An MCP config file: printed only without --cli. */
|
|
59
|
+
const mcpFile = (file) => (cli ? [] : [file]);
|
|
60
|
+
const intro = (mcp, shell) => (cli ? shell + CLI_NOTE : mcp);
|
|
45
61
|
switch (host) {
|
|
46
62
|
case "generic":
|
|
47
63
|
return {
|
|
48
64
|
host,
|
|
49
|
-
intro: "Add this block to the instructions file your agent reads (AGENTS.md,
|
|
65
|
+
intro: intro("Add this block to the instructions file your agent reads (AGENTS.md, GEMINI.md). The MCP server is npx -y @tidegap/mcp. " +
|
|
66
|
+
"For an agent that runs shell commands, tidegap jobs snippet --cli prints the CLI variant.", "Add this block to the instructions file your agent reads (AGENTS.md, GEMINI.md).") + " For Claude Code, run tidegap jobs snippet --host claude.",
|
|
50
67
|
files: [markdown("AGENTS.md")],
|
|
51
68
|
};
|
|
52
69
|
case "claude":
|
|
@@ -55,24 +72,24 @@ export function agentSnippet(host) {
|
|
|
55
72
|
intro: "The Tidegap plugin already does this (skill text, a prompt hint, and a guard that asks before crontab): " +
|
|
56
73
|
"/plugin marketplace add tidegap/tidegap, then /plugin install tidegap. Without the plugin, add the block to CLAUDE.md " +
|
|
57
74
|
"(~/.claude/CLAUDE.md for every project).",
|
|
58
|
-
files: [
|
|
75
|
+
files: [{ path: "CLAUDE.md", format: "markdown", content: CLAUDE_CODE_BLOCK }],
|
|
59
76
|
};
|
|
60
77
|
case "opencode":
|
|
61
78
|
return {
|
|
62
79
|
host,
|
|
63
|
-
intro: "Create the skill, then merge the MCP entry and the bash rules into opencode.json (keep your own \"*\" rule if you have one).",
|
|
80
|
+
intro: intro("Create the skill, then merge the MCP entry and the bash rules into opencode.json (keep your own \"*\" rule if you have one).", "Create the skill, then merge the bash rules into opencode.json (keep your own \"*\" rule if you have one)."),
|
|
64
81
|
files: [
|
|
65
82
|
{
|
|
66
83
|
path: "~/.config/opencode/skills/tidegap/SKILL.md",
|
|
67
84
|
format: "markdown",
|
|
68
|
-
content: `---\nname: tidegap\ndescription: ${DESCRIPTION}\n---\n\n${
|
|
85
|
+
content: `---\nname: tidegap\ndescription: ${DESCRIPTION}\n---\n\n${block}`,
|
|
69
86
|
},
|
|
70
87
|
{
|
|
71
88
|
path: "~/.config/opencode/opencode.json",
|
|
72
89
|
format: "json",
|
|
73
90
|
content: json({
|
|
74
91
|
$schema: "https://opencode.ai/config.json",
|
|
75
|
-
mcp: { tidegap: { type: "local", command: ["npx", ...MCP_ARGS], enabled: true } },
|
|
92
|
+
...(cli ? {} : { mcp: { tidegap: { type: "local", command: ["npx", ...MCP_ARGS], enabled: true } } }),
|
|
76
93
|
permission: { bash: OPENCODE_BASH },
|
|
77
94
|
}),
|
|
78
95
|
},
|
|
@@ -81,40 +98,40 @@ export function agentSnippet(host) {
|
|
|
81
98
|
case "codex":
|
|
82
99
|
return {
|
|
83
100
|
host,
|
|
84
|
-
intro: "Add the block to AGENTS.md and the MCP table to config.toml.",
|
|
101
|
+
intro: intro("Add the block to AGENTS.md and the MCP table to config.toml.", "Add the block to AGENTS.md."),
|
|
85
102
|
files: [
|
|
86
103
|
markdown("~/.codex/AGENTS.md"),
|
|
87
|
-
{
|
|
104
|
+
...mcpFile({
|
|
88
105
|
path: "~/.codex/config.toml",
|
|
89
106
|
format: "toml",
|
|
90
107
|
content: `[mcp_servers.tidegap]\ncommand = "npx"\nargs = ${JSON.stringify(MCP_ARGS).replace(/,/g, ", ")}\n`,
|
|
91
|
-
},
|
|
108
|
+
}),
|
|
92
109
|
],
|
|
93
110
|
};
|
|
94
111
|
case "cursor":
|
|
95
112
|
return {
|
|
96
113
|
host,
|
|
97
|
-
intro: "Create the rule in your project and add the MCP entry to .cursor/mcp.json.",
|
|
114
|
+
intro: intro("Create the rule in your project and add the MCP entry to .cursor/mcp.json.", "Create the rule in your project."),
|
|
98
115
|
files: [
|
|
99
116
|
{
|
|
100
117
|
path: ".cursor/rules/tidegap.mdc",
|
|
101
118
|
format: "markdown",
|
|
102
|
-
content: `---\ndescription: ${DESCRIPTION}\nalwaysApply: false\n---\n\n${
|
|
119
|
+
content: `---\ndescription: ${DESCRIPTION}\nalwaysApply: false\n---\n\n${block}`,
|
|
103
120
|
},
|
|
104
|
-
{ path: ".cursor/mcp.json", format: "json", content: mcpServers },
|
|
121
|
+
...mcpFile({ path: ".cursor/mcp.json", format: "json", content: mcpServers }),
|
|
105
122
|
],
|
|
106
123
|
};
|
|
107
124
|
case "gemini":
|
|
108
125
|
return {
|
|
109
126
|
host,
|
|
110
|
-
intro: "Add the block to GEMINI.md and merge the MCP entry into settings.json.",
|
|
111
|
-
files: [markdown("~/.gemini/GEMINI.md"), { path: "~/.gemini/settings.json", format: "json", content: mcpServers }],
|
|
127
|
+
intro: intro("Add the block to GEMINI.md and merge the MCP entry into settings.json.", "Add the block to GEMINI.md."),
|
|
128
|
+
files: [markdown("~/.gemini/GEMINI.md"), ...mcpFile({ path: "~/.gemini/settings.json", format: "json", content: mcpServers })],
|
|
112
129
|
};
|
|
113
130
|
}
|
|
114
131
|
}
|
|
115
|
-
/** The text `tidegap jobs snippet --host <host
|
|
116
|
-
export function renderAgentSnippet(host) {
|
|
117
|
-
const s = agentSnippet(host);
|
|
132
|
+
/** The text `tidegap jobs snippet --host <host> [--cli]` prints. */
|
|
133
|
+
export function renderAgentSnippet(host, opts = {}) {
|
|
134
|
+
const s = agentSnippet(host, opts);
|
|
118
135
|
return [s.intro, ...s.files.map((f) => `${f.path}:\n\n${f.content.trimEnd()}`)].join("\n\n");
|
|
119
136
|
}
|
|
120
137
|
//# sourceMappingURL=agent-snippet.js.map
|
package/dist/index.d.ts
CHANGED
|
@@ -108,6 +108,6 @@ export { canonicalize, defaultSigningKeyPath, loadOrCreateSigningKey, signReceip
|
|
|
108
108
|
export type { SigningKeyOptions, SigningKeyPair, VerifyOutcome, VerifyResult, } from "./sign.js";
|
|
109
109
|
export { TIDEGAP_HOME_DIR, resolveTidegapHome, tidegapPath, } from "./paths.js";
|
|
110
110
|
export type { ResolveHomeOptions } from "./paths.js";
|
|
111
|
-
export { AGENT_HOSTS, AGENTS_BLOCK, agentSnippet, isAgentHost, renderAgentSnippet, } from "./agent-snippet.js";
|
|
112
|
-
export type { AgentHost, AgentSnippet, AgentSnippetFile } from "./agent-snippet.js";
|
|
111
|
+
export { AGENT_HOSTS, AGENTS_BLOCK, agentSnippet, CLI_AGENTS_BLOCK, isAgentHost, renderAgentSnippet, } from "./agent-snippet.js";
|
|
112
|
+
export type { AgentHost, AgentSnippet, AgentSnippetFile, AgentSnippetOptions } from "./agent-snippet.js";
|
|
113
113
|
//# sourceMappingURL=index.d.ts.map
|
package/dist/index.js
CHANGED
|
@@ -91,5 +91,5 @@ export { ALL_TOOL_HOSTS, TOOL_SURFACE, getToolDef, getToolDefOrThrow, toolsForHo
|
|
|
91
91
|
export { commandJobRefusal, QUEUE_ADD_COMMAND_LINE, endJobOfTask, isJobRepeat, JOB_ONLY_PARAMS, JOB_REPEATS, jobParamsRefusal, jobToolsFor, jobToolView, jobUnsupportedRefusal, jobWakeArgs, llmTimeoutArg, retryCapsArgs, scheduleJobInput, } from "./schedule-job.js";
|
|
92
92
|
export { canonicalize, defaultSigningKeyPath, loadOrCreateSigningKey, signReceipt, verifyReceipt, } from "./sign.js";
|
|
93
93
|
export { TIDEGAP_HOME_DIR, resolveTidegapHome, tidegapPath, } from "./paths.js";
|
|
94
|
-
export { AGENT_HOSTS, AGENTS_BLOCK, agentSnippet, isAgentHost, renderAgentSnippet, } from "./agent-snippet.js";
|
|
94
|
+
export { AGENT_HOSTS, AGENTS_BLOCK, agentSnippet, CLI_AGENTS_BLOCK, isAgentHost, renderAgentSnippet, } from "./agent-snippet.js";
|
|
95
95
|
//# sourceMappingURL=index.js.map
|
package/dist/redact.d.ts
CHANGED
|
@@ -11,6 +11,10 @@
|
|
|
11
11
|
* a previous generic `[A-Z]{2,3}_[A-Z0-9]{6,}` catch-all mangled
|
|
12
12
|
* legitimate prose (DB_PASSWORD, US-MIDA-PJM-style codes, ISO_8601)
|
|
13
13
|
* while missing every real vendor key shape below.
|
|
14
|
+
*
|
|
15
|
+
* A pattern has no word boundary after the key: it is the prefix plus at
|
|
16
|
+
* least the key's body length, and the match runs to the end of the body
|
|
17
|
+
* characters, so a longer key or one that ends in `-` is redacted whole.
|
|
14
18
|
*/
|
|
15
19
|
export declare const DEFAULT_REDACTION_PATTERNS: ReadonlyArray<RegExp>;
|
|
16
20
|
/**
|
package/dist/redact.js
CHANGED
|
@@ -11,16 +11,20 @@
|
|
|
11
11
|
* a previous generic `[A-Z]{2,3}_[A-Z0-9]{6,}` catch-all mangled
|
|
12
12
|
* legitimate prose (DB_PASSWORD, US-MIDA-PJM-style codes, ISO_8601)
|
|
13
13
|
* while missing every real vendor key shape below.
|
|
14
|
+
*
|
|
15
|
+
* A pattern has no word boundary after the key: it is the prefix plus at
|
|
16
|
+
* least the key's body length, and the match runs to the end of the body
|
|
17
|
+
* characters, so a longer key or one that ends in `-` is redacted whole.
|
|
14
18
|
*/
|
|
15
19
|
export const DEFAULT_REDACTION_PATTERNS = [
|
|
16
20
|
/sk-(?:ant-)?[A-Za-z0-9_\-]{20,}/g, // Anthropic / OpenAI legacy
|
|
17
21
|
/sk-proj-[A-Za-z0-9_\-]{20,}/g, // OpenAI project keys
|
|
18
|
-
/\bBearer\s+[A-Za-z0-9_
|
|
19
|
-
/\bAKIA[0-9A-Z]{16}
|
|
20
|
-
/\b(?:ghp|gho|ghu|ghs|ghr)_[A-Za-z0-9]{36}
|
|
21
|
-
/\bgithub_pat_[A-Za-z0-9_]{22,}
|
|
22
|
-
/\bAIza[0-9A-Za-z_\-]{35}
|
|
23
|
-
/\bxox[baprs]-[A-Za-z0-9-]{10,}
|
|
22
|
+
/\bBearer\s+[A-Za-z0-9_\-.~+/=]{20,}/gi, // OAuth bearer tokens (RFC 6750 token characters)
|
|
23
|
+
/\bAKIA[0-9A-Z]{16,}/g, // AWS access key id
|
|
24
|
+
/\b(?:ghp|gho|ghu|ghs|ghr)_[A-Za-z0-9]{36,}/g, // GitHub tokens
|
|
25
|
+
/\bgithub_pat_[A-Za-z0-9_]{22,}/g, // GitHub fine-grained PAT
|
|
26
|
+
/\bAIza[0-9A-Za-z_\-]{35,}/g, // Google API key
|
|
27
|
+
/\bxox[baprs]-[A-Za-z0-9-]{10,}/g, // Slack tokens
|
|
24
28
|
/\beyJ[A-Za-z0-9_-]{10,}\.eyJ[A-Za-z0-9_-]{10,}\.[A-Za-z0-9_-]{10,}/g, // JWT
|
|
25
29
|
// Telegram bot token. No word boundary before it: a Bot API URL puts "bot" right in front.
|
|
26
30
|
/(?<!\d)\d{8,10}:[A-Za-z0-9_-]{35}(?![A-Za-z0-9_-])/g,
|
|
@@ -38,7 +42,7 @@ export const DEFAULT_REDACTION_PATTERNS = [
|
|
|
38
42
|
*/
|
|
39
43
|
export const VENDOR_KEY_PREFIXES = [
|
|
40
44
|
{ prefix: "sk-", body: "A-Za-z0-9_\\-", boundary: false },
|
|
41
|
-
{ prefix: "Bearer\\s+", body: "A-Za-z0-9_
|
|
45
|
+
{ prefix: "Bearer\\s+", body: "A-Za-z0-9_\\-.~+/=", boundary: true, ignoreCase: true },
|
|
42
46
|
{ prefix: "AKIA", body: "0-9A-Z", boundary: true },
|
|
43
47
|
{ prefix: "gh[pousr]_", body: "A-Za-z0-9", boundary: true },
|
|
44
48
|
{ prefix: "github_pat_", body: "A-Za-z0-9_", boundary: true },
|
|
@@ -52,8 +56,34 @@ export const VENDOR_KEY_PREFIXES = [
|
|
|
52
56
|
const TRAILING_KEY = VENDOR_KEY_PREFIXES.map(({ prefix, body, boundary, ignoreCase }) => new RegExp(`${boundary ? "(?<![A-Za-z0-9_])" : ""}${prefix}[${body}]+$`, ignoreCase ? "i" : ""));
|
|
53
57
|
/** The end of a cut text the trailing-key search reads; no key shape is longer. */
|
|
54
58
|
const TRAILING_WINDOW = 8 * 1024;
|
|
55
|
-
/**
|
|
56
|
-
|
|
59
|
+
/**
|
|
60
|
+
* A leading token this long at a cut start may be the tail of a key; it is
|
|
61
|
+
* dropped. It takes every body character of {@link VENDOR_KEY_PREFIXES}, so a
|
|
62
|
+
* Bearer tail with `+`, `/`, `~` or `=` goes whole.
|
|
63
|
+
*/
|
|
64
|
+
const LEADING_TOKEN = /^[A-Za-z0-9_\-.~+/=]{16,}/;
|
|
65
|
+
/**
|
|
66
|
+
* True when a custom pattern opens a `(?` group other than `(?:`, `(?=`,
|
|
67
|
+
* `(?!`, a lookbehind or a named group. Such a pattern is skipped: Node
|
|
68
|
+
* rejects `(?i)`, only Node 24 and later accept `(?i:...)`, and the Python
|
|
69
|
+
* core skips the same patterns. Escapes and character classes are stepped
|
|
70
|
+
* over.
|
|
71
|
+
*/
|
|
72
|
+
function opensUnsupportedGroup(pattern) {
|
|
73
|
+
let inClass = false;
|
|
74
|
+
for (let i = 0; i < pattern.length; i++) {
|
|
75
|
+
const c = pattern[i];
|
|
76
|
+
if (c === "\\")
|
|
77
|
+
i++;
|
|
78
|
+
else if (inClass)
|
|
79
|
+
inClass = c !== "]";
|
|
80
|
+
else if (c === "[")
|
|
81
|
+
inClass = true;
|
|
82
|
+
else if (c === "(" && pattern[i + 1] === "?" && !":=!<".includes(pattern.charAt(i + 2)))
|
|
83
|
+
return true;
|
|
84
|
+
}
|
|
85
|
+
return false;
|
|
86
|
+
}
|
|
57
87
|
/**
|
|
58
88
|
* Apply the spec's redaction patterns (or the default set) to the
|
|
59
89
|
* prompt before storing it on the receipt. Original prompt is left
|
|
@@ -70,6 +100,8 @@ export function redactPrompt(prompt, patterns) {
|
|
|
70
100
|
}
|
|
71
101
|
else if (patterns.length > 0) {
|
|
72
102
|
for (const raw of patterns) {
|
|
103
|
+
if (opensUnsupportedGroup(raw))
|
|
104
|
+
continue;
|
|
73
105
|
try {
|
|
74
106
|
apply(new RegExp(raw, "g"));
|
|
75
107
|
}
|
package/dist/types.d.ts
CHANGED
|
@@ -413,7 +413,11 @@ export interface ProviderCallSpec {
|
|
|
413
413
|
* keys (`sk-...`, `ak_...`, OAuth bearer tokens). Pass `[]` to
|
|
414
414
|
* disable redaction entirely. The receipt's `prompt` field is
|
|
415
415
|
* always the redacted version; the dispatched call uses the
|
|
416
|
-
* original.
|
|
416
|
+
* original. A pattern is JavaScript regex syntax with no flags; one
|
|
417
|
+
* that does not compile, or that opens a `(?` group other than `(?:`,
|
|
418
|
+
* `(?=`, `(?!`, a lookbehind or a named group (so no `(?i)`), is skipped.
|
|
419
|
+
* The Python core skips a pattern that `re` cannot compile, such as a
|
|
420
|
+
* lookbehind of variable width, where this core applies it.
|
|
417
421
|
*/
|
|
418
422
|
redactInReceipt?: string[];
|
|
419
423
|
/**
|