@tickernelz/paperclip-pro-adapter-claude-local 2026.925.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/LICENSE +22 -0
- package/dist/cli/format-event.d.ts +2 -0
- package/dist/cli/format-event.d.ts.map +1 -0
- package/dist/cli/format-event.js +141 -0
- package/dist/cli/format-event.js.map +1 -0
- package/dist/cli/index.d.ts +2 -0
- package/dist/cli/index.d.ts.map +1 -0
- package/dist/cli/index.js +2 -0
- package/dist/cli/index.js.map +1 -0
- package/dist/cli/quota-probe.d.ts +3 -0
- package/dist/cli/quota-probe.d.ts.map +1 -0
- package/dist/cli/quota-probe.js +106 -0
- package/dist/cli/quota-probe.js.map +1 -0
- package/dist/index.d.ts +13 -0
- package/dist/index.d.ts.map +1 -0
- package/dist/index.js +90 -0
- package/dist/index.js.map +1 -0
- package/dist/index.test.d.ts +2 -0
- package/dist/index.test.d.ts.map +1 -0
- package/dist/index.test.js +35 -0
- package/dist/index.test.js.map +1 -0
- package/dist/server/acp.auth.test.d.ts +2 -0
- package/dist/server/acp.auth.test.d.ts.map +1 -0
- package/dist/server/acp.auth.test.js +581 -0
- package/dist/server/acp.auth.test.js.map +1 -0
- package/dist/server/acp.d.ts +68 -0
- package/dist/server/acp.d.ts.map +1 -0
- package/dist/server/acp.js +779 -0
- package/dist/server/acp.js.map +1 -0
- package/dist/server/acp.quota.test.d.ts +2 -0
- package/dist/server/acp.quota.test.d.ts.map +1 -0
- package/dist/server/acp.quota.test.js +114 -0
- package/dist/server/acp.quota.test.js.map +1 -0
- package/dist/server/acp.test.d.ts +2 -0
- package/dist/server/acp.test.d.ts.map +1 -0
- package/dist/server/acp.test.js +1153 -0
- package/dist/server/acp.test.js.map +1 -0
- package/dist/server/auth-check.d.ts +8 -0
- package/dist/server/auth-check.d.ts.map +1 -0
- package/dist/server/auth-check.js +8 -0
- package/dist/server/auth-check.js.map +1 -0
- package/dist/server/claude-config.d.ts +49 -0
- package/dist/server/claude-config.d.ts.map +1 -0
- package/dist/server/claude-config.js +279 -0
- package/dist/server/claude-config.js.map +1 -0
- package/dist/server/claude-config.test.d.ts +2 -0
- package/dist/server/claude-config.test.d.ts.map +1 -0
- package/dist/server/claude-config.test.js +197 -0
- package/dist/server/claude-config.test.js.map +1 -0
- package/dist/server/cli-capabilities.d.ts +26 -0
- package/dist/server/cli-capabilities.d.ts.map +1 -0
- package/dist/server/cli-capabilities.js +115 -0
- package/dist/server/cli-capabilities.js.map +1 -0
- package/dist/server/config-schema.d.ts +3 -0
- package/dist/server/config-schema.d.ts.map +1 -0
- package/dist/server/config-schema.js +67 -0
- package/dist/server/config-schema.js.map +1 -0
- package/dist/server/engine-availability.test.d.ts +2 -0
- package/dist/server/engine-availability.test.d.ts.map +1 -0
- package/dist/server/engine-availability.test.js +41 -0
- package/dist/server/engine-availability.test.js.map +1 -0
- package/dist/server/execute.acp-fallback.test.d.ts +2 -0
- package/dist/server/execute.acp-fallback.test.d.ts.map +1 -0
- package/dist/server/execute.acp-fallback.test.js +104 -0
- package/dist/server/execute.acp-fallback.test.js.map +1 -0
- package/dist/server/execute.d.ts +23 -0
- package/dist/server/execute.d.ts.map +1 -0
- package/dist/server/execute.js +1089 -0
- package/dist/server/execute.js.map +1 -0
- package/dist/server/execute.remote.test.d.ts +2 -0
- package/dist/server/execute.remote.test.d.ts.map +1 -0
- package/dist/server/execute.remote.test.js +484 -0
- package/dist/server/execute.remote.test.js.map +1 -0
- package/dist/server/index.d.ts +16 -0
- package/dist/server/index.d.ts.map +1 -0
- package/dist/server/index.js +84 -0
- package/dist/server/index.js.map +1 -0
- package/dist/server/models.d.ts +13 -0
- package/dist/server/models.d.ts.map +1 -0
- package/dist/server/models.js +153 -0
- package/dist/server/models.js.map +1 -0
- package/dist/server/parse.d.ts +58 -0
- package/dist/server/parse.d.ts.map +1 -0
- package/dist/server/parse.js +459 -0
- package/dist/server/parse.js.map +1 -0
- package/dist/server/parse.test.d.ts +2 -0
- package/dist/server/parse.test.d.ts.map +1 -0
- package/dist/server/parse.test.js +419 -0
- package/dist/server/parse.test.js.map +1 -0
- package/dist/server/permissions.d.ts +14 -0
- package/dist/server/permissions.d.ts.map +1 -0
- package/dist/server/permissions.js +13 -0
- package/dist/server/permissions.js.map +1 -0
- package/dist/server/permissions.test.d.ts +2 -0
- package/dist/server/permissions.test.d.ts.map +1 -0
- package/dist/server/permissions.test.js +22 -0
- package/dist/server/permissions.test.js.map +1 -0
- package/dist/server/probe-diagnostics.d.ts +102 -0
- package/dist/server/probe-diagnostics.d.ts.map +1 -0
- package/dist/server/probe-diagnostics.js +140 -0
- package/dist/server/probe-diagnostics.js.map +1 -0
- package/dist/server/probe-diagnostics.test.d.ts +2 -0
- package/dist/server/probe-diagnostics.test.d.ts.map +1 -0
- package/dist/server/probe-diagnostics.test.js +114 -0
- package/dist/server/probe-diagnostics.test.js.map +1 -0
- package/dist/server/probe-env.d.ts +42 -0
- package/dist/server/probe-env.d.ts.map +1 -0
- package/dist/server/probe-env.js +149 -0
- package/dist/server/probe-env.js.map +1 -0
- package/dist/server/probe-env.test.d.ts +2 -0
- package/dist/server/probe-env.test.d.ts.map +1 -0
- package/dist/server/probe-env.test.js +135 -0
- package/dist/server/probe-env.test.js.map +1 -0
- package/dist/server/probe-redaction.test.d.ts +2 -0
- package/dist/server/probe-redaction.test.d.ts.map +1 -0
- package/dist/server/probe-redaction.test.js +86 -0
- package/dist/server/probe-redaction.test.js.map +1 -0
- package/dist/server/prompt-cache.d.ts +17 -0
- package/dist/server/prompt-cache.d.ts.map +1 -0
- package/dist/server/prompt-cache.js +126 -0
- package/dist/server/prompt-cache.js.map +1 -0
- package/dist/server/quota-keychain.test.d.ts +2 -0
- package/dist/server/quota-keychain.test.d.ts.map +1 -0
- package/dist/server/quota-keychain.test.js +83 -0
- package/dist/server/quota-keychain.test.js.map +1 -0
- package/dist/server/quota.d.ts +30 -0
- package/dist/server/quota.d.ts.map +1 -0
- package/dist/server/quota.js +543 -0
- package/dist/server/quota.js.map +1 -0
- package/dist/server/setup-token-characterization.test.d.ts +2 -0
- package/dist/server/setup-token-characterization.test.d.ts.map +1 -0
- package/dist/server/setup-token-characterization.test.js +123 -0
- package/dist/server/setup-token-characterization.test.js.map +1 -0
- package/dist/server/setup-token-parse.d.ts +47 -0
- package/dist/server/setup-token-parse.d.ts.map +1 -0
- package/dist/server/setup-token-parse.js +506 -0
- package/dist/server/setup-token-parse.js.map +1 -0
- package/dist/server/setup-token-parse.test.d.ts +2 -0
- package/dist/server/setup-token-parse.test.d.ts.map +1 -0
- package/dist/server/setup-token-parse.test.js +587 -0
- package/dist/server/setup-token-parse.test.js.map +1 -0
- package/dist/server/setup-token-runner.d.ts +115 -0
- package/dist/server/setup-token-runner.d.ts.map +1 -0
- package/dist/server/setup-token-runner.js +317 -0
- package/dist/server/setup-token-runner.js.map +1 -0
- package/dist/server/setup-token-runner.test.d.ts +2 -0
- package/dist/server/setup-token-runner.test.d.ts.map +1 -0
- package/dist/server/setup-token-runner.test.js +336 -0
- package/dist/server/setup-token-runner.test.js.map +1 -0
- package/dist/server/skills.d.ts +8 -0
- package/dist/server/skills.d.ts.map +1 -0
- package/dist/server/skills.js +42 -0
- package/dist/server/skills.js.map +1 -0
- package/dist/server/test.d.ts +3 -0
- package/dist/server/test.d.ts.map +1 -0
- package/dist/server/test.js +434 -0
- package/dist/server/test.js.map +1 -0
- package/dist/server/test.probe.test.d.ts +2 -0
- package/dist/server/test.probe.test.d.ts.map +1 -0
- package/dist/server/test.probe.test.js +608 -0
- package/dist/server/test.probe.test.js.map +1 -0
- package/dist/server/test.remote.test.d.ts +2 -0
- package/dist/server/test.remote.test.d.ts.map +1 -0
- package/dist/server/test.remote.test.js +149 -0
- package/dist/server/test.remote.test.js.map +1 -0
- package/dist/ui/build-config.d.ts +3 -0
- package/dist/ui/build-config.d.ts.map +1 -0
- package/dist/ui/build-config.js +76 -0
- package/dist/ui/build-config.js.map +1 -0
- package/dist/ui/build-config.test.d.ts +2 -0
- package/dist/ui/build-config.test.d.ts.map +1 -0
- package/dist/ui/build-config.test.js +68 -0
- package/dist/ui/build-config.test.js.map +1 -0
- package/dist/ui/index.d.ts +3 -0
- package/dist/ui/index.d.ts.map +1 -0
- package/dist/ui/index.js +3 -0
- package/dist/ui/index.js.map +1 -0
- package/dist/ui/parse-stdout.d.ts +3 -0
- package/dist/ui/parse-stdout.d.ts.map +1 -0
- package/dist/ui/parse-stdout.js +153 -0
- package/dist/ui/parse-stdout.js.map +1 -0
- package/package.json +63 -0
- package/skills/agentmail/SKILL.md +70 -0
- package/skills/paperclip/SKILL.md +712 -0
- package/skills/paperclip/references/api-reference.md +1675 -0
- package/skills/paperclip/references/artifacts.md +158 -0
- package/skills/paperclip/references/cases.md +295 -0
- package/skills/paperclip/references/company-skills.md +266 -0
- package/skills/paperclip/references/issue-workspaces.md +80 -0
- package/skills/paperclip/references/routines.md +231 -0
- package/skills/paperclip/references/workflows.md +141 -0
- package/skills/paperclip/scripts/paperclip-upload-artifact.sh +592 -0
- package/skills/paperclip-board/SKILL.md +619 -0
- package/skills/paperclip-converting-plans-to-tasks/SKILL.md +60 -0
- package/skills/paperclip-create-agent/SKILL.md +179 -0
- package/skills/paperclip-create-agent/references/agent-instruction-templates.md +123 -0
- package/skills/paperclip-create-agent/references/agents/coder.md +64 -0
- package/skills/paperclip-create-agent/references/agents/qa.md +88 -0
- package/skills/paperclip-create-agent/references/agents/securityengineer.md +135 -0
- package/skills/paperclip-create-agent/references/agents/uxdesigner.md +115 -0
- package/skills/paperclip-create-agent/references/api-reference.md +110 -0
- package/skills/paperclip-create-agent/references/baseline-role-guide.md +168 -0
- package/skills/paperclip-create-agent/references/draft-review-checklist.md +95 -0
- package/skills/para-memory-files/SKILL.md +100 -0
- package/skills/para-memory-files/references/schemas.md +35 -0
- package/skills/slack/SKILL.md +65 -0
|
@@ -0,0 +1,123 @@
|
|
|
1
|
+
import { execFileSync, spawnSync } from "node:child_process";
|
|
2
|
+
import { describe, expect, it } from "vitest";
|
|
3
|
+
import { parseSetupTokenPrompt, SETUP_TOKEN_AUTH_URLS, SETUP_TOKEN_PROMPT, SETUP_TOKEN_URL_QUERY_KEYS, } from "./setup-token-parse.js";
|
|
4
|
+
// The live characterization of `claude setup-token`. This suite runs the real
|
|
5
|
+
// Claude Code login command in a real pseudo-terminal, captures the sign-in
|
|
6
|
+
// prompt output, and confirms the parser reads the real terminal contract. It
|
|
7
|
+
// records the tested Claude Code version. It fails loudly on a parse miss, so a
|
|
8
|
+
// terminal-contract drift breaks the suite instead of passing silently.
|
|
9
|
+
//
|
|
10
|
+
// The suite is opt-in. It needs the real `claude` binary, `python3` for the
|
|
11
|
+
// pseudo-terminal, and network access to claude.com to mint the authorization
|
|
12
|
+
// URL, so it never runs in a normal or a continuous-integration test run. Set
|
|
13
|
+
// `RUN_CLAUDE_SETUP_TOKEN_CHARACTERIZATION=1` to run it in a real sandbox.
|
|
14
|
+
//
|
|
15
|
+
// Security: the suite drives only the prompt phase. It never submits a browser
|
|
16
|
+
// code, so the command never mints a token. It parses the captured bytes in
|
|
17
|
+
// memory and asserts only the non-secret shape (the URL origin, the URL path,
|
|
18
|
+
// the URL query keys, and the constant prompt). It never writes the captured
|
|
19
|
+
// bytes, the real authorization URL, or any token to a durable file, a log, or
|
|
20
|
+
// an assertion message.
|
|
21
|
+
const OPT_IN = process.env.RUN_CLAUDE_SETUP_TOKEN_CHARACTERIZATION === "1";
|
|
22
|
+
// A pseudo-terminal harness. It runs `claude setup-token` on a real
|
|
23
|
+
// pseudo-terminal with a wide window, streams the raw terminal bytes to its own
|
|
24
|
+
// standard output, and stops when it sees the prompt phrase or after a timeout.
|
|
25
|
+
// It never submits a code, so the command never mints a token.
|
|
26
|
+
const PTY_HARNESS = `
|
|
27
|
+
import os, pty, sys, select, time, fcntl, termios, struct, signal
|
|
28
|
+
duration = float(os.environ.get("STCHAR_DURATION", "40"))
|
|
29
|
+
cols, rows = 200, 50
|
|
30
|
+
pid, fd = pty.fork()
|
|
31
|
+
if pid == 0:
|
|
32
|
+
os.execvp("claude", ["claude", "setup-token"])
|
|
33
|
+
os._exit(127)
|
|
34
|
+
fcntl.ioctl(fd, termios.TIOCSWINSZ, struct.pack("HHHH", rows, cols, 0, 0))
|
|
35
|
+
acc = b""
|
|
36
|
+
start = time.time()
|
|
37
|
+
try:
|
|
38
|
+
while time.time() - start < duration:
|
|
39
|
+
r, _, _ = select.select([fd], [], [], 0.5)
|
|
40
|
+
if fd in r:
|
|
41
|
+
try:
|
|
42
|
+
data = os.read(fd, 65536)
|
|
43
|
+
except OSError:
|
|
44
|
+
break
|
|
45
|
+
if not data:
|
|
46
|
+
break
|
|
47
|
+
acc += data
|
|
48
|
+
os.write(1, data)
|
|
49
|
+
if b"Paste code here if prompted" in acc:
|
|
50
|
+
break
|
|
51
|
+
finally:
|
|
52
|
+
try:
|
|
53
|
+
os.kill(pid, signal.SIGKILL)
|
|
54
|
+
except ProcessLookupError:
|
|
55
|
+
pass
|
|
56
|
+
try:
|
|
57
|
+
os.waitpid(pid, 0)
|
|
58
|
+
except ChildProcessError:
|
|
59
|
+
pass
|
|
60
|
+
`;
|
|
61
|
+
function hasCommand(command) {
|
|
62
|
+
const probe = spawnSync("sh", ["-c", `command -v ${command}`], { encoding: "utf8" });
|
|
63
|
+
return probe.status === 0;
|
|
64
|
+
}
|
|
65
|
+
function readClaudeVersion() {
|
|
66
|
+
const raw = execFileSync("claude", ["--version"], { encoding: "utf8" });
|
|
67
|
+
// The version line reads like `2.1.226 (Claude Code)`. Read the leading
|
|
68
|
+
// semantic version.
|
|
69
|
+
const match = raw.match(/(\d+\.\d+\.\d+)/);
|
|
70
|
+
if (!match)
|
|
71
|
+
throw new Error("could not read the Claude Code version");
|
|
72
|
+
return match[1];
|
|
73
|
+
}
|
|
74
|
+
// Removes the terminal control sequences the same way the parser does, so the
|
|
75
|
+
// test can assert on the rendered banner text. It keeps this local, so the test
|
|
76
|
+
// never imports a parser internal.
|
|
77
|
+
function renderForBanner(raw) {
|
|
78
|
+
return raw
|
|
79
|
+
// OSC sequences (hyperlinks and other OSC), BEL or ST terminated.
|
|
80
|
+
.replace(/\x1b\][^\x1b\x07]*(?:\x1b\\|\x07)/g, "")
|
|
81
|
+
// Horizontal-move CSI sequences render as one space.
|
|
82
|
+
.replace(/\x1b\[[0-9;]*[GC]/g, " ")
|
|
83
|
+
// Any remaining CSI sequence.
|
|
84
|
+
.replace(/\x1b\[[0-?]*[ -/]*[@-~]/g, "");
|
|
85
|
+
}
|
|
86
|
+
const run = OPT_IN ? describe : describe.skip;
|
|
87
|
+
run("claude setup-token live characterization", () => {
|
|
88
|
+
it("reads the real sign-in prompt contract and records the Claude Code version", () => {
|
|
89
|
+
expect(hasCommand("claude"), "the claude binary must be installed").toBe(true);
|
|
90
|
+
expect(hasCommand("python3"), "python3 must be installed for the pseudo-terminal").toBe(true);
|
|
91
|
+
const version = readClaudeVersion();
|
|
92
|
+
const result = spawnSync("python3", ["-c", PTY_HARNESS], {
|
|
93
|
+
encoding: "buffer",
|
|
94
|
+
maxBuffer: 8 * 1024 * 1024,
|
|
95
|
+
env: { ...process.env, STCHAR_DURATION: "40" },
|
|
96
|
+
});
|
|
97
|
+
if (result.error)
|
|
98
|
+
throw result.error;
|
|
99
|
+
const raw = (result.stdout ?? Buffer.alloc(0)).toString("utf8");
|
|
100
|
+
// Fail loudly on a parse miss. A terminal-contract drift breaks the suite
|
|
101
|
+
// here instead of passing silently.
|
|
102
|
+
const parsed = parseSetupTokenPrompt(raw);
|
|
103
|
+
expect(parsed, "the parser did not read the live setup-token prompt").not.toBeNull();
|
|
104
|
+
const url = new URL(parsed.url);
|
|
105
|
+
// The live CLI emits one of the two accepted origin-and-path pairs. The
|
|
106
|
+
// installed version decides which pair the run records.
|
|
107
|
+
expect(SETUP_TOKEN_AUTH_URLS).toContain(`${url.origin}${url.pathname}`);
|
|
108
|
+
expect([...url.searchParams.keys()].sort()).toEqual([...SETUP_TOKEN_URL_QUERY_KEYS].sort());
|
|
109
|
+
expect(url.hash).toBe("");
|
|
110
|
+
expect(parsed.prompt).toBe(SETUP_TOKEN_PROMPT);
|
|
111
|
+
// The banner names the tested Claude Code version. This ties the recorded
|
|
112
|
+
// contract to the version that produced it.
|
|
113
|
+
const banner = renderForBanner(raw);
|
|
114
|
+
expect(banner).toContain(`Claude Code v${version}`);
|
|
115
|
+
// Record the tested version and the non-secret anchors. The reporter shows
|
|
116
|
+
// this line; it names no secret.
|
|
117
|
+
// eslint-disable-next-line no-console
|
|
118
|
+
console.log(`[characterization] Claude Code v${version}: prompt "${SETUP_TOKEN_PROMPT}", ` +
|
|
119
|
+
`URL ${url.origin}${url.pathname} with query keys ` +
|
|
120
|
+
`[${[...SETUP_TOKEN_URL_QUERY_KEYS].join(", ")}].`);
|
|
121
|
+
}, 60_000);
|
|
122
|
+
});
|
|
123
|
+
//# sourceMappingURL=setup-token-characterization.test.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"setup-token-characterization.test.js","sourceRoot":"","sources":["../../src/server/setup-token-characterization.test.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,YAAY,EAAE,SAAS,EAAE,MAAM,oBAAoB,CAAC;AAC7D,OAAO,EAAE,QAAQ,EAAE,MAAM,EAAE,EAAE,EAAE,MAAM,QAAQ,CAAC;AAC9C,OAAO,EACL,qBAAqB,EACrB,qBAAqB,EACrB,kBAAkB,EAClB,0BAA0B,GAC3B,MAAM,wBAAwB,CAAC;AAEhC,8EAA8E;AAC9E,4EAA4E;AAC5E,8EAA8E;AAC9E,gFAAgF;AAChF,wEAAwE;AACxE,EAAE;AACF,4EAA4E;AAC5E,8EAA8E;AAC9E,8EAA8E;AAC9E,2EAA2E;AAC3E,EAAE;AACF,+EAA+E;AAC/E,4EAA4E;AAC5E,8EAA8E;AAC9E,6EAA6E;AAC7E,+EAA+E;AAC/E,wBAAwB;AAExB,MAAM,MAAM,GAAG,OAAO,CAAC,GAAG,CAAC,uCAAuC,KAAK,G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AAE,CAAC,CAAC;QAC5F,MAAM,CAAC,GAAG,CAAC,IAAI,CAAC,CAAC,IAAI,CAAC,EAAE,CAAC,CAAC;QAC1B,MAAM,CAAC,MAAO,CAAC,MAAM,CAAC,CAAC,IAAI,CAAC,kBAAkB,CAAC,CAAC;QAEhD,0EAA0E;QAC1E,4CAA4C;QAC5C,MAAM,MAAM,GAAG,eAAe,CAAC,GAAG,CAAC,CAAC;QACpC,MAAM,CAAC,MAAM,CAAC,CAAC,SAAS,CAAC,gBAAgB,OAAO,EAAE,CAAC,CAAC;QAEpD,2EAA2E;QAC3E,iCAAiC;QACjC,sCAAsC;QACtC,OAAO,CAAC,GAAG,CACT,mCAAmC,OAAO,aAAa,kBAAkB,KAAK;YAC5E,OAAO,GAAG,CAAC,MAAM,GAAG,GAAG,CAAC,QAAQ,mBAAmB;YACnD,IAAI,CAAC,GAAG,0BAA0B,CAAC,CAAC,IAAI,CAAC,IAAI,CAAC,IAAI,CACrD,CAAC;IACJ,CAAC,EACD,MAAM,CACP,CAAC;AACJ,CAAC,CAAC,CAAC"}
|
|
@@ -0,0 +1,47 @@
|
|
|
1
|
+
export interface SetupTokenPrompt {
|
|
2
|
+
url: string;
|
|
3
|
+
prompt: string;
|
|
4
|
+
}
|
|
5
|
+
export declare const SETUP_TOKEN_PROMPT = "Paste code here if prompted";
|
|
6
|
+
export declare const SETUP_TOKEN_AUTH_URLS: readonly ["https://claude.ai/oauth/authorize", "https://claude.com/cai/oauth/authorize"];
|
|
7
|
+
export declare const SETUP_TOKEN_REDIRECT_URI = "https://platform.claude.com/oauth/code/callback";
|
|
8
|
+
export declare const SETUP_TOKEN_URL_QUERY_KEYS: readonly ["client_id", "code", "code_challenge", "code_challenge_method", "redirect_uri", "response_type", "scope", "state"];
|
|
9
|
+
/**
|
|
10
|
+
* Parses Claude `setup-token` login output. Removes the terminal control
|
|
11
|
+
* sequences first, so colored and hyperlinked output reads the same as plain
|
|
12
|
+
* output. The parser finds the URL preamble, then a physical line that starts the
|
|
13
|
+
* authorization URL within {@link MAX_PREAMBLE_TO_URL_GAP} characters of the
|
|
14
|
+
* preamble, then reassembles the wrapped URL and validates the final string, then
|
|
15
|
+
* binds the browser-code prompt on the dedicated line after the URL block. So the
|
|
16
|
+
* URL binds to the login context and the prompt binds to the URL. Returns the
|
|
17
|
+
* authorization URL and the browser-code prompt when both are present and valid.
|
|
18
|
+
* Returns null for any other input, including a non-string input, an absent
|
|
19
|
+
* preamble, a URL with a wrong host, path, query, or fragment, an API-key-shaped
|
|
20
|
+
* URL, and a missing or misplaced prompt. Never throws on input, and never puts
|
|
21
|
+
* any input byte into a log or an error. This phase returns no token.
|
|
22
|
+
*/
|
|
23
|
+
export declare function parseSetupTokenPrompt(text: string): SetupTokenPrompt | null;
|
|
24
|
+
export declare const SETUP_TOKEN_PREFIX = "sk-ant-oat01-";
|
|
25
|
+
export declare const SETUP_TOKEN_BEFORE_ANCHOR = "Your OAuth token (valid for 1 year):";
|
|
26
|
+
export declare const SETUP_TOKEN_AFTER_ANCHOR = "Store this token securely. You won't be able to see it again.";
|
|
27
|
+
/**
|
|
28
|
+
* Parses the Claude `setup-token` success screen and returns the minted OAuth
|
|
29
|
+
* token, or null. The parser removes the terminal control sequences first, then
|
|
30
|
+
* binds the token to the exact success record. It requires the before-anchor
|
|
31
|
+
* line {@link SETUP_TOKEN_BEFORE_ANCHOR} and the after-anchor line
|
|
32
|
+
* {@link SETUP_TOKEN_AFTER_ANCHOR}, in that order, exactly one time each. It
|
|
33
|
+
* reads only the lines between the two anchors. It de-wraps the token: it joins
|
|
34
|
+
* the fragment lines with no separator, the same way the terminal split one
|
|
35
|
+
* token across the physical lines. It validates the joined value against the
|
|
36
|
+
* token shape.
|
|
37
|
+
*
|
|
38
|
+
* The parser fails closed for any other input. It returns null for a
|
|
39
|
+
* token-shaped value outside the two anchors (before submit, in retry or error
|
|
40
|
+
* text, or after a cancellation), a duplicate success block, an anchor out of
|
|
41
|
+
* order, a missing anchor, extra text on a token line, a stray prose line
|
|
42
|
+
* between the anchors, a wrong prefix, and a value that does not match the token
|
|
43
|
+
* shape. It never logs any input byte and never puts any input byte into a
|
|
44
|
+
* thrown error. The parser is a pure function.
|
|
45
|
+
*/
|
|
46
|
+
export declare function parseSetupTokenCredential(text: string): string | null;
|
|
47
|
+
//# sourceMappingURL=setup-token-parse.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"setup-token-parse.d.ts","sourceRoot":"","sources":["../../src/server/setup-token-parse.ts"],"names":[],"mappings":"AA0BA,MAAM,WAAW,gBAAgB;IAE/B,GAAG,EAAE,MAAM,CAAC;IAGZ,MAAM,EAAE,MAAM,CAAC;CAChB;AAKD,eAAO,MAAM,kBAAkB,gCAAgC,CAAC;AAOhE,eAAO,MAAM,qBAAqB,YAChC,mCAAmC,EACnC,wCAAwC,CAChC,CAAC;AAiBX,eAAO,MAAM,wBAAwB,oDAAoD,CAAC;AAK1F,eAAO,MAAM,0BAA0B,YACrC,WAAW,EACX,MAAM,EACN,gBAAgB,EAChB,uBAAuB,EACvB,cAAc,EACd,eAAe,EACf,OAAO,EACP,OAAO,CACC,CAAC;AAgTX;;;;;;;;;;;;;GAaG;AACH,wBAAgB,qBAAqB,CAAC,IAAI,EAAE,MAAM,GAAG,gBAAgB,GAAG,IAAI,CAyB3E;AAMD,eAAO,MAAM,kBAAkB,kBAAkB,CAAC;AAIlD,eAAO,MAAM,yBAAyB,yCAAyC,CAAC;AAIhF,eAAO,MAAM,wBAAwB,kEAC4B,CAAC;AA6BlE;;;;;;;;;;;;;;;;;;GAkBG;AACH,wBAAgB,yBAAyB,CAAC,IAAI,EAAE,MAAM,GAAG,MAAM,GAAG,IAAI,CAiCrE"}
|