@sriinnu/fiche 0.0.0-stage → 0.19.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/CHANGELOG.md +134 -0
- package/LICENSE +22 -0
- package/NOTICE +13 -0
- package/PRIVACY.md +41 -0
- package/README.md +288 -2
- package/SECURITY.md +53 -0
- package/assets/JETBRAINS_MONO_LICENSE.txt +89 -0
- package/assets/SPLEEN_LICENSE.txt +24 -0
- package/assets/UNIFONT_LICENSE.txt +476 -0
- package/assets/fiche-logo-dark.svg +61 -0
- package/assets/fiche-logo-light.svg +61 -0
- package/assets/fiche-logo.svg +71 -0
- package/assets/fiche-mark.svg +48 -0
- package/bin/cli.js +7 -0
- package/bin/mcp.js +8 -0
- package/dist/calibrate.d.ts +30 -0
- package/dist/calibrate.js +588 -0
- package/dist/core/anthropic-vision.d.ts +28 -0
- package/dist/core/anthropic-vision.js +34 -0
- package/dist/core/applicability.d.ts +63 -0
- package/dist/core/applicability.js +151 -0
- package/dist/core/atlas-gray-jbmono10.d.ts +26 -0
- package/dist/core/atlas-gray-jbmono10.js +64 -0
- package/dist/core/atlas-gray-jbmono12.d.ts +26 -0
- package/dist/core/atlas-gray-jbmono12.js +64 -0
- package/dist/core/atlas-gray-jbmono14.d.ts +26 -0
- package/dist/core/atlas-gray-jbmono14.js +64 -0
- package/dist/core/atlas-gray.d.ts +26 -0
- package/dist/core/atlas-gray.js +64 -0
- package/dist/core/atlas-jbmono10.d.ts +34 -0
- package/dist/core/atlas-jbmono10.js +71 -0
- package/dist/core/atlas-jbmono12.d.ts +34 -0
- package/dist/core/atlas-jbmono12.js +71 -0
- package/dist/core/atlas-jbmono14.d.ts +34 -0
- package/dist/core/atlas-jbmono14.js +71 -0
- package/dist/core/atlas.d.ts +34 -0
- package/dist/core/atlas.js +71 -0
- package/dist/core/baseline.d.ts +121 -0
- package/dist/core/baseline.js +200 -0
- package/dist/core/calibration.d.ts +86 -0
- package/dist/core/calibration.js +547 -0
- package/dist/core/casi-delta.d.ts +63 -0
- package/dist/core/casi-delta.js +1271 -0
- package/dist/core/claude-model-profiles.d.ts +53 -0
- package/dist/core/claude-model-profiles.js +160 -0
- package/dist/core/client-tool-round.d.ts +31 -0
- package/dist/core/client-tool-round.js +58 -0
- package/dist/core/codex-cache.d.ts +20 -0
- package/dist/core/codex-cache.js +59 -0
- package/dist/core/context-mmu.d.ts +350 -0
- package/dist/core/context-mmu.js +3028 -0
- package/dist/core/cpt-fit.d.ts +70 -0
- package/dist/core/cpt-fit.js +197 -0
- package/dist/core/env.d.ts +8 -0
- package/dist/core/env.js +15 -0
- package/dist/core/export.d.ts +127 -0
- package/dist/core/export.js +385 -0
- package/dist/core/factsheet.d.ts +77 -0
- package/dist/core/factsheet.js +494 -0
- package/dist/core/gemini-model-profiles.d.ts +20 -0
- package/dist/core/gemini-model-profiles.js +134 -0
- package/dist/core/google.d.ts +76 -0
- package/dist/core/google.js +1380 -0
- package/dist/core/gpt-model-profiles.d.ts +218 -0
- package/dist/core/gpt-model-profiles.js +570 -0
- package/dist/core/gpt-tokens.d.ts +14 -0
- package/dist/core/gpt-tokens.js +165 -0
- package/dist/core/history.d.ts +197 -0
- package/dist/core/history.js +1003 -0
- package/dist/core/index.d.ts +16 -0
- package/dist/core/index.js +16 -0
- package/dist/core/library.d.ts +80 -0
- package/dist/core/library.js +131 -0
- package/dist/core/measurement.d.ts +34 -0
- package/dist/core/measurement.js +280 -0
- package/dist/core/messages-chat-bridge.d.ts +23 -0
- package/dist/core/messages-chat-bridge.js +747 -0
- package/dist/core/messages-responses-bridge.d.ts +11 -0
- package/dist/core/messages-responses-bridge.js +893 -0
- package/dist/core/openai-history.d.ts +184 -0
- package/dist/core/openai-history.js +1279 -0
- package/dist/core/openai-savings.d.ts +57 -0
- package/dist/core/openai-savings.js +116 -0
- package/dist/core/openai.d.ts +68 -0
- package/dist/core/openai.js +2523 -0
- package/dist/core/pin.d.ts +199 -0
- package/dist/core/pin.js +1353 -0
- package/dist/core/png.d.ts +14 -0
- package/dist/core/png.js +188 -0
- package/dist/core/prefix-tape.d.ts +102 -0
- package/dist/core/prefix-tape.js +315 -0
- package/dist/core/price-id.d.ts +10 -0
- package/dist/core/price-id.js +26 -0
- package/dist/core/prices.generated.d.ts +36 -0
- package/dist/core/prices.generated.js +369 -0
- package/dist/core/pricing.d.ts +134 -0
- package/dist/core/pricing.js +335 -0
- package/dist/core/profile-base.d.ts +30 -0
- package/dist/core/profile-base.js +67 -0
- package/dist/core/provider-router.d.ts +51 -0
- package/dist/core/provider-router.js +121 -0
- package/dist/core/proxy.d.ts +252 -0
- package/dist/core/proxy.js +2929 -0
- package/dist/core/reader-tier.d.ts +24 -0
- package/dist/core/reader-tier.js +118 -0
- package/dist/core/render.d.ts +280 -0
- package/dist/core/render.js +1302 -0
- package/dist/core/request-guard.d.ts +31 -0
- package/dist/core/request-guard.js +126 -0
- package/dist/core/request-transform.d.ts +43 -0
- package/dist/core/request-transform.js +173 -0
- package/dist/core/schema-compiler.d.ts +64 -0
- package/dist/core/schema-compiler.js +1696 -0
- package/dist/core/schema-strip.d.ts +29 -0
- package/dist/core/schema-strip.js +173 -0
- package/dist/core/session-state.d.ts +219 -0
- package/dist/core/session-state.js +929 -0
- package/dist/core/stage-plugins.d.ts +45 -0
- package/dist/core/stage-plugins.js +205 -0
- package/dist/core/text-history.d.ts +74 -0
- package/dist/core/text-history.js +612 -0
- package/dist/core/text-hygiene.d.ts +160 -0
- package/dist/core/text-hygiene.js +2259 -0
- package/dist/core/toon.d.ts +29 -0
- package/dist/core/toon.js +425 -0
- package/dist/core/tracker.d.ts +223 -0
- package/dist/core/tracker.js +290 -0
- package/dist/core/transform.d.ts +589 -0
- package/dist/core/transform.js +3153 -0
- package/dist/core/types.d.ts +87 -0
- package/dist/core/types.js +8 -0
- package/dist/core/upstream-hosts.d.ts +127 -0
- package/dist/core/upstream-hosts.js +398 -0
- package/dist/core/vision-cost.d.ts +63 -0
- package/dist/core/vision-cost.js +137 -0
- package/dist/dashboard/fragments.d.ts +87 -0
- package/dist/dashboard/fragments.js +1515 -0
- package/dist/dashboard/types.d.ts +217 -0
- package/dist/dashboard/types.js +3 -0
- package/dist/dashboard/vendor.d.ts +3 -0
- package/dist/dashboard/vendor.js +6 -0
- package/dist/dashboard.d.ts +372 -0
- package/dist/dashboard.js +2731 -0
- package/dist/export-collect.d.ts +36 -0
- package/dist/export-collect.js +59 -0
- package/dist/file-tracker.d.ts +42 -0
- package/dist/file-tracker.js +234 -0
- package/dist/kosha-sync.d.ts +74 -0
- package/dist/kosha-sync.js +272 -0
- package/dist/launchd-socket.d.ts +22 -0
- package/dist/launchd-socket.js +210 -0
- package/dist/mcp/cli.d.ts +2 -0
- package/dist/mcp/cli.js +55 -0
- package/dist/mcp/server.d.ts +48 -0
- package/dist/mcp/server.js +987 -0
- package/dist/mmu-store.d.ts +31 -0
- package/dist/mmu-store.js +179 -0
- package/dist/node-fetch.d.ts +22 -0
- package/dist/node-fetch.js +489 -0
- package/dist/node.d.ts +9 -0
- package/dist/node.js +244396 -0
- package/dist/request-decoding.d.ts +30 -0
- package/dist/request-decoding.js +85 -0
- package/dist/sessions.d.ts +179 -0
- package/dist/sessions.js +837 -0
- package/dist/stats.d.ts +114 -0
- package/dist/stats.js +439 -0
- package/dist/turn-report.d.ts +65 -0
- package/dist/turn-report.js +724 -0
- package/dist/warp/app-launch.d.ts +26 -0
- package/dist/warp/app-launch.js +155 -0
- package/dist/warp/ca.d.ts +74 -0
- package/dist/warp/ca.js +416 -0
- package/dist/warp/connect.d.ts +42 -0
- package/dist/warp/connect.js +686 -0
- package/dist/warp/der.d.ts +57 -0
- package/dist/warp/der.js +151 -0
- package/dist/warp/index.d.ts +79 -0
- package/dist/warp/index.js +650 -0
- package/dist/warp/resolve.d.ts +12 -0
- package/dist/warp/resolve.js +49 -0
- package/dist/warp/route.d.ts +71 -0
- package/dist/warp/route.js +134 -0
- package/dist/worker.d.ts +71 -0
- package/dist/worker.js +174 -0
- package/docs/SECURITY_MODEL.md +84 -0
- package/package.json +122 -4
- package/plugins/fiche-companion/README.md +42 -0
- package/plugins/fiche-companion/assets/logo.svg +48 -0
- package/plugins/fiche-companion/hooks.json +11 -0
- package/plugins/fiche-companion/mcp_config.json +8 -0
- package/plugins/fiche-companion/plugin.json +18 -0
- package/plugins/fiche-companion/scripts/claude-statusline.mjs +35 -0
- package/plugins/fiche-companion/scripts/post-invocation.mjs +122 -0
- package/plugins/fiche-companion/scripts/resolve-turn-report.mjs +132 -0
- package/plugins/fiche-companion/skills/fiche/SKILL.md +61 -0
|
@@ -0,0 +1,57 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Minimal DER writer — just enough ASN.1 to mint an X.509 certificate.
|
|
3
|
+
*
|
|
4
|
+
* Node can generate keys and sign bytes, but unlike Go's crypto/x509 it has no
|
|
5
|
+
* certificate *issuer*: `new X509Certificate()` only parses. Everything here
|
|
6
|
+
* exists to build the handful of structures in RFC 5280 that a leaf and a root
|
|
7
|
+
* need, so warp can run its own CA without pulling in a dependency.
|
|
8
|
+
*
|
|
9
|
+
* Only the write path is implemented. Parsing is left to node:crypto's
|
|
10
|
+
* X509Certificate, which is why nothing here reads DER back.
|
|
11
|
+
*/
|
|
12
|
+
export declare const TAG: {
|
|
13
|
+
readonly BOOLEAN: 1;
|
|
14
|
+
readonly INTEGER: 2;
|
|
15
|
+
readonly BIT_STRING: 3;
|
|
16
|
+
readonly OCTET_STRING: 4;
|
|
17
|
+
readonly OID: 6;
|
|
18
|
+
readonly UTF8_STRING: 12;
|
|
19
|
+
readonly SEQUENCE: 48;
|
|
20
|
+
readonly SET: 49;
|
|
21
|
+
readonly IA5_STRING: 22;
|
|
22
|
+
readonly UTC_TIME: 23;
|
|
23
|
+
};
|
|
24
|
+
export declare function concatBytes(chunks: Uint8Array[]): Uint8Array;
|
|
25
|
+
/** tag + length + contents, the shape every other helper is built from. */
|
|
26
|
+
export declare function tlv(tag: number, body: Uint8Array): Uint8Array;
|
|
27
|
+
export declare function seq(...items: Uint8Array[]): Uint8Array;
|
|
28
|
+
export declare function set(...items: Uint8Array[]): Uint8Array;
|
|
29
|
+
export declare function bool(value: boolean): Uint8Array;
|
|
30
|
+
/**
|
|
31
|
+
* INTEGER is signed two's complement: strip redundant leading zero bytes, then
|
|
32
|
+
* re-add one if the top bit would otherwise read as negative. Serial numbers
|
|
33
|
+
* are the reason this matters — a random 16-byte serial is negative half the
|
|
34
|
+
* time, and a negative serial is a spec violation some verifiers reject.
|
|
35
|
+
*/
|
|
36
|
+
export declare function integer(value: number | Uint8Array): Uint8Array;
|
|
37
|
+
/**
|
|
38
|
+
* OID: first two arcs pack into one byte (40*a + b), the rest are base-128 with
|
|
39
|
+
* a continuation bit on every byte but the last.
|
|
40
|
+
*/
|
|
41
|
+
export declare function oid(dotted: string): Uint8Array;
|
|
42
|
+
export declare function utf8String(value: string): Uint8Array;
|
|
43
|
+
export declare function ia5String(value: string): Uint8Array;
|
|
44
|
+
export declare function octetString(body: Uint8Array): Uint8Array;
|
|
45
|
+
/** BIT STRING carries a leading count of unused bits in its final byte. */
|
|
46
|
+
export declare function bitString(body: Uint8Array, unusedBits?: number): Uint8Array;
|
|
47
|
+
/** Context-specific tag, e.g. [0] EXPLICIT / [2] IMPLICIT in a SAN. */
|
|
48
|
+
export declare function contextTag(n: number, body: Uint8Array, constructed?: boolean): Uint8Array;
|
|
49
|
+
/**
|
|
50
|
+
* UTCTime is YYMMDDHHMMSSZ and is only unambiguous through 2049; RFC 5280
|
|
51
|
+
* requires GeneralizedTime past that. Both certs we mint are short-lived
|
|
52
|
+
* relative to that ceiling, but assert rather than silently emit a date that
|
|
53
|
+
* verifiers will read as 19xx.
|
|
54
|
+
*/
|
|
55
|
+
export declare function utcTime(date: Date): Uint8Array;
|
|
56
|
+
export declare function pem(label: string, der: Uint8Array): string;
|
|
57
|
+
//# sourceMappingURL=der.d.ts.map
|
package/dist/warp/der.js
ADDED
|
@@ -0,0 +1,151 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Minimal DER writer — just enough ASN.1 to mint an X.509 certificate.
|
|
3
|
+
*
|
|
4
|
+
* Node can generate keys and sign bytes, but unlike Go's crypto/x509 it has no
|
|
5
|
+
* certificate *issuer*: `new X509Certificate()` only parses. Everything here
|
|
6
|
+
* exists to build the handful of structures in RFC 5280 that a leaf and a root
|
|
7
|
+
* need, so warp can run its own CA without pulling in a dependency.
|
|
8
|
+
*
|
|
9
|
+
* Only the write path is implemented. Parsing is left to node:crypto's
|
|
10
|
+
* X509Certificate, which is why nothing here reads DER back.
|
|
11
|
+
*/
|
|
12
|
+
const textEncoder = new TextEncoder();
|
|
13
|
+
export const TAG = {
|
|
14
|
+
BOOLEAN: 0x01,
|
|
15
|
+
INTEGER: 0x02,
|
|
16
|
+
BIT_STRING: 0x03,
|
|
17
|
+
OCTET_STRING: 0x04,
|
|
18
|
+
OID: 0x06,
|
|
19
|
+
UTF8_STRING: 0x0c,
|
|
20
|
+
SEQUENCE: 0x30,
|
|
21
|
+
SET: 0x31,
|
|
22
|
+
IA5_STRING: 0x16,
|
|
23
|
+
UTC_TIME: 0x17,
|
|
24
|
+
};
|
|
25
|
+
export function concatBytes(chunks) {
|
|
26
|
+
let total = 0;
|
|
27
|
+
for (const chunk of chunks)
|
|
28
|
+
total += chunk.length;
|
|
29
|
+
const out = new Uint8Array(total);
|
|
30
|
+
let offset = 0;
|
|
31
|
+
for (const chunk of chunks) {
|
|
32
|
+
out.set(chunk, offset);
|
|
33
|
+
offset += chunk.length;
|
|
34
|
+
}
|
|
35
|
+
return out;
|
|
36
|
+
}
|
|
37
|
+
/**
|
|
38
|
+
* DER length: short form below 128, else a leading count-of-bytes marked with
|
|
39
|
+
* the high bit. Indefinite length is forbidden in DER, so this is total.
|
|
40
|
+
*/
|
|
41
|
+
function encodeLength(n) {
|
|
42
|
+
if (n < 0x80)
|
|
43
|
+
return Uint8Array.of(n);
|
|
44
|
+
const bytes = [];
|
|
45
|
+
for (let v = n; v > 0; v = Math.floor(v / 256))
|
|
46
|
+
bytes.unshift(v % 256);
|
|
47
|
+
return Uint8Array.from([0x80 | bytes.length, ...bytes]);
|
|
48
|
+
}
|
|
49
|
+
/** tag + length + contents, the shape every other helper is built from. */
|
|
50
|
+
export function tlv(tag, body) {
|
|
51
|
+
return concatBytes([Uint8Array.of(tag), encodeLength(body.length), body]);
|
|
52
|
+
}
|
|
53
|
+
export function seq(...items) {
|
|
54
|
+
return tlv(TAG.SEQUENCE, concatBytes(items));
|
|
55
|
+
}
|
|
56
|
+
export function set(...items) {
|
|
57
|
+
return tlv(TAG.SET, concatBytes(items));
|
|
58
|
+
}
|
|
59
|
+
export function bool(value) {
|
|
60
|
+
return tlv(TAG.BOOLEAN, Uint8Array.of(value ? 0xff : 0x00));
|
|
61
|
+
}
|
|
62
|
+
/**
|
|
63
|
+
* INTEGER is signed two's complement: strip redundant leading zero bytes, then
|
|
64
|
+
* re-add one if the top bit would otherwise read as negative. Serial numbers
|
|
65
|
+
* are the reason this matters — a random 16-byte serial is negative half the
|
|
66
|
+
* time, and a negative serial is a spec violation some verifiers reject.
|
|
67
|
+
*/
|
|
68
|
+
export function integer(value) {
|
|
69
|
+
let bytes;
|
|
70
|
+
if (typeof value === 'number') {
|
|
71
|
+
if (value === 0)
|
|
72
|
+
return tlv(TAG.INTEGER, Uint8Array.of(0));
|
|
73
|
+
bytes = [];
|
|
74
|
+
for (let v = value; v > 0; v = Math.floor(v / 256))
|
|
75
|
+
bytes.unshift(v % 256);
|
|
76
|
+
}
|
|
77
|
+
else {
|
|
78
|
+
bytes = Array.from(value);
|
|
79
|
+
}
|
|
80
|
+
while (bytes.length > 1 && bytes[0] === 0x00 && (bytes[1] & 0x80) === 0)
|
|
81
|
+
bytes.shift();
|
|
82
|
+
if ((bytes[0] & 0x80) !== 0)
|
|
83
|
+
bytes.unshift(0x00);
|
|
84
|
+
return tlv(TAG.INTEGER, Uint8Array.from(bytes));
|
|
85
|
+
}
|
|
86
|
+
/**
|
|
87
|
+
* OID: first two arcs pack into one byte (40*a + b), the rest are base-128 with
|
|
88
|
+
* a continuation bit on every byte but the last.
|
|
89
|
+
*/
|
|
90
|
+
export function oid(dotted) {
|
|
91
|
+
const arcs = dotted.split('.').map((a) => Number.parseInt(a, 10));
|
|
92
|
+
if (arcs.length < 2 || arcs.some((a) => !Number.isFinite(a))) {
|
|
93
|
+
throw new Error(`bad OID: ${dotted}`);
|
|
94
|
+
}
|
|
95
|
+
const out = [40 * arcs[0] + arcs[1]];
|
|
96
|
+
for (const arc of arcs.slice(2)) {
|
|
97
|
+
const septets = [];
|
|
98
|
+
let v = arc;
|
|
99
|
+
do {
|
|
100
|
+
septets.unshift(v & 0x7f);
|
|
101
|
+
v = Math.floor(v / 128);
|
|
102
|
+
} while (v > 0);
|
|
103
|
+
for (let i = 0; i < septets.length - 1; i++)
|
|
104
|
+
septets[i] |= 0x80;
|
|
105
|
+
out.push(...septets);
|
|
106
|
+
}
|
|
107
|
+
return tlv(TAG.OID, Uint8Array.from(out));
|
|
108
|
+
}
|
|
109
|
+
export function utf8String(value) {
|
|
110
|
+
return tlv(TAG.UTF8_STRING, textEncoder.encode(value));
|
|
111
|
+
}
|
|
112
|
+
export function ia5String(value) {
|
|
113
|
+
return tlv(TAG.IA5_STRING, textEncoder.encode(value));
|
|
114
|
+
}
|
|
115
|
+
export function octetString(body) {
|
|
116
|
+
return tlv(TAG.OCTET_STRING, body);
|
|
117
|
+
}
|
|
118
|
+
/** BIT STRING carries a leading count of unused bits in its final byte. */
|
|
119
|
+
export function bitString(body, unusedBits = 0) {
|
|
120
|
+
return tlv(TAG.BIT_STRING, concatBytes([Uint8Array.of(unusedBits), body]));
|
|
121
|
+
}
|
|
122
|
+
/** Context-specific tag, e.g. [0] EXPLICIT / [2] IMPLICIT in a SAN. */
|
|
123
|
+
export function contextTag(n, body, constructed = true) {
|
|
124
|
+
return tlv(0x80 | (constructed ? 0x20 : 0x00) | n, body);
|
|
125
|
+
}
|
|
126
|
+
/**
|
|
127
|
+
* UTCTime is YYMMDDHHMMSSZ and is only unambiguous through 2049; RFC 5280
|
|
128
|
+
* requires GeneralizedTime past that. Both certs we mint are short-lived
|
|
129
|
+
* relative to that ceiling, but assert rather than silently emit a date that
|
|
130
|
+
* verifiers will read as 19xx.
|
|
131
|
+
*/
|
|
132
|
+
export function utcTime(date) {
|
|
133
|
+
const year = date.getUTCFullYear();
|
|
134
|
+
if (year >= 2050)
|
|
135
|
+
throw new Error('utcTime: dates past 2049 need GeneralizedTime');
|
|
136
|
+
const p2 = (v) => String(v).padStart(2, '0');
|
|
137
|
+
const stamp = p2(year % 100) +
|
|
138
|
+
p2(date.getUTCMonth() + 1) +
|
|
139
|
+
p2(date.getUTCDate()) +
|
|
140
|
+
p2(date.getUTCHours()) +
|
|
141
|
+
p2(date.getUTCMinutes()) +
|
|
142
|
+
p2(date.getUTCSeconds()) +
|
|
143
|
+
'Z';
|
|
144
|
+
return tlv(TAG.UTC_TIME, textEncoder.encode(stamp));
|
|
145
|
+
}
|
|
146
|
+
export function pem(label, der) {
|
|
147
|
+
const b64 = Buffer.from(der).toString('base64');
|
|
148
|
+
const lines = b64.match(/.{1,64}/g) ?? [];
|
|
149
|
+
return `-----BEGIN ${label}-----\n${lines.join('\n')}\n-----END ${label}-----\n`;
|
|
150
|
+
}
|
|
151
|
+
//# sourceMappingURL=der.js.map
|
|
@@ -0,0 +1,79 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* `inkling warp -- <agent-command>`
|
|
3
|
+
*
|
|
4
|
+
* Runs the agent behind a CONNECT proxy that decrypts api.anthropic.com and
|
|
5
|
+
* re-points only /v1/messages at the local inkling proxy. The agent never sees a
|
|
6
|
+
* custom ANTHROPIC_BASE_URL, so the client-side "firstParty" checks that hide
|
|
7
|
+
* /remote-control (and disable claude.ai connectors) still pass, while inkling
|
|
8
|
+
* gets the one path it transforms.
|
|
9
|
+
*
|
|
10
|
+
* Compare the manual equivalent, which needs two extra tools and a CA trusted
|
|
11
|
+
* process-wide:
|
|
12
|
+
*
|
|
13
|
+
* mitmdump --map-remote '|^https://api\.anthropic\.com/v1/messages|http://127.0.0.1:47821/v1/messages'
|
|
14
|
+
* HTTPS_PROXY=http://127.0.0.1:8080 NODE_EXTRA_CA_CERTS=~/.mitmproxy/mitmproxy-ca-cert.pem claude
|
|
15
|
+
*/
|
|
16
|
+
import { type ResolvedMacApp } from './app-launch.js';
|
|
17
|
+
import { type Route } from './route.js';
|
|
18
|
+
import { type ProviderId } from '../core/upstream-hosts.js';
|
|
19
|
+
/**
|
|
20
|
+
* Augment wrapped child argv when necessary so clients keep HTTP traffic inside
|
|
21
|
+
* warp's session rather than delegating to an unwrapped background daemon.
|
|
22
|
+
* For `codex` (>= 0.172), inject `-c features.daemon_auto_start=false` unless
|
|
23
|
+
* running daemon-management/meta commands, already overridden, or disabled via
|
|
24
|
+
* `FICHE_CODEX_KEEP_DAEMON=1`.
|
|
25
|
+
*/
|
|
26
|
+
export declare function augmentWrappedCommand(command: readonly string[], env?: NodeJS.ProcessEnv): string[];
|
|
27
|
+
/**
|
|
28
|
+
* Load or atomically generate the per-user 0600 loopback warp auth secret
|
|
29
|
+
* (`~/.fiche/warp-token`) used to authenticate warped desktop apps to Fiche.
|
|
30
|
+
*/
|
|
31
|
+
export declare function loadOrCreateWarpToken(dir: string): string;
|
|
32
|
+
/**
|
|
33
|
+
* Only strip `ANTHROPIC_BASE_URL` when it points to Fiche's own local loopback
|
|
34
|
+
* proxy (`127.0.0.1:<port>`, `localhost:<port>`, `[::1]:<port>`). Remote 3rd-party
|
|
35
|
+
* base URLs (DeepSeek, Kimi, GLM, MiniMax, Qwen, OpenRouter, custom gateways)
|
|
36
|
+
* are preserved so warp routes them via `followHosts`.
|
|
37
|
+
*/
|
|
38
|
+
export declare function shouldStripAnthropicBaseUrl(rawUrl: string | undefined, fichePort: number): boolean;
|
|
39
|
+
export declare function mergeNoProxy(existing: string | undefined, excludeHosts?: ReadonlySet<string>): string;
|
|
40
|
+
export interface WarpRuntimeOptions {
|
|
41
|
+
/** Port the inkling proxy is already serving on: where matches are sent. */
|
|
42
|
+
port: number;
|
|
43
|
+
/**
|
|
44
|
+
* Extra PATTERN=TARGET rules, in priority order ahead of the default
|
|
45
|
+
* Anthropic rule. Agents that reach their provider over a base URL rather
|
|
46
|
+
* than api.anthropic.com (codex, opencode) need one rule each.
|
|
47
|
+
*/
|
|
48
|
+
routes?: readonly string[];
|
|
49
|
+
/** Explicit provider filter for this warp session; defaults to getEnabledProviders(). */
|
|
50
|
+
providers?: readonly ProviderId[];
|
|
51
|
+
/** Print every expanded warp route pattern on startup instead of the grouped summary. */
|
|
52
|
+
verbose?: boolean;
|
|
53
|
+
/** Optional resolved macOS desktop `.app` bundle launched via `fiche warp --app`. */
|
|
54
|
+
app?: ResolvedMacApp;
|
|
55
|
+
}
|
|
56
|
+
export interface WarpRuntime {
|
|
57
|
+
/** Bind the child's proxy port, then spawn the child. */
|
|
58
|
+
launch: (command: string[]) => void;
|
|
59
|
+
}
|
|
60
|
+
/**
|
|
61
|
+
* Only the inference path is diverted for enabled providers. Everything else on
|
|
62
|
+
* the host — OAuth, telemetry, the control plane — is re-originated untouched,
|
|
63
|
+
* which is what keeps the agent's client-side gates satisfied.
|
|
64
|
+
*/
|
|
65
|
+
export declare function defaultRoutes(port: number, enabledProviders?: readonly ProviderId[]): Route[];
|
|
66
|
+
/**
|
|
67
|
+
* Third-party providers from the same registry fiche follows, so warp diverts
|
|
68
|
+
* only opted-in built-in providers (or all when `enabledProviders` is omitted
|
|
69
|
+
* for direct callers) plus explicit `FICHE_UPSTREAM_HOSTS` custom entries.
|
|
70
|
+
*/
|
|
71
|
+
export declare function compatRoutes(port: number, enabledProviders?: readonly ProviderId[]): Route[];
|
|
72
|
+
/**
|
|
73
|
+
* Probe whether a local fiche daemon is accepting TCP connections on `127.0.0.1:port`.
|
|
74
|
+
* Used by `fiche warp` so wrapped commands fall back to an unwrapped launch
|
|
75
|
+
* whenever the daemon is intentionally stopped.
|
|
76
|
+
*/
|
|
77
|
+
export declare function isLocalDaemonReachable(port: number, timeoutMs?: number): Promise<boolean>;
|
|
78
|
+
export declare function createWarpRuntime(options: WarpRuntimeOptions): WarpRuntime;
|
|
79
|
+
//# sourceMappingURL=index.d.ts.map
|