@agentdocumentformat/cli 0.7.8 → 0.8.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/README.md +1 -1
- package/dist/adf.mjs +59 -8
- package/dist/chunks/{APEv2Parser-2CNNHMXV.mjs → APEv2Parser-WIXRJLHB.mjs} +2 -2
- package/dist/chunks/{AiffParser-7BR4RL6G.mjs → AiffParser-ZC4QFOVJ.mjs} +5 -5
- package/dist/chunks/{App-7RIIOHJJ.mjs → App-4AZZJNN2.mjs} +917 -826
- package/dist/chunks/{DsdiffParser-CMD4AX7A.mjs → DsdiffParser-UAPAJHFX.mjs} +5 -5
- package/dist/chunks/{DsfParser-UOGZDS2M.mjs → DsfParser-NNYZK2QX.mjs} +6 -6
- package/dist/chunks/{FlacParser-HB3T3CD4.mjs → FlacParser-MW2W4LO3.mjs} +6 -6
- package/dist/chunks/{MP4Parser-66HBRUSX.mjs → MP4Parser-Z57SYOOQ.mjs} +4 -4
- package/dist/chunks/{MpegParser-YW6LIUEW.mjs → MpegParser-XIIPAZVM.mjs} +7 -7
- package/dist/chunks/{MusepackParser-PAUSXP7D.mjs → MusepackParser-QWNDEYHJ.mjs} +6 -6
- package/dist/chunks/{OggParser-NUBV3GWC.mjs → OggParser-WRX53F77.mjs} +9 -9
- package/dist/chunks/{WavPackParser-WQAGT7TC.mjs → WavPackParser-MJ7WCSJ5.mjs} +2 -2
- package/dist/chunks/{WaveParser-EWLQVDX4.mjs → WaveParser-RAVLHZ5S.mjs} +7 -7
- package/dist/chunks/{adf-schema-US4NFHMR.mjs → adf-schema-AIPBQTR2.mjs} +9 -3
- package/dist/chunks/auth-manager-AJ32FZWS.mjs +19 -0
- package/dist/chunks/auth-manager-C5OBEQK2.mjs +18 -0
- package/dist/chunks/auth-manager-TBNKCJ45.mjs +17 -0
- package/dist/chunks/{chatgpt-subscription-E4MXTIAT.mjs → chatgpt-subscription-MMGNW5KJ.mjs} +5 -2
- package/dist/chunks/chunk-2Z7X3UUR.mjs +678 -0
- package/dist/chunks/chunk-3UGZFWIF.mjs +26 -0
- package/dist/chunks/{chunk-XNPZBLYL.mjs → chunk-75DC5EWN.mjs} +13 -2
- package/dist/chunks/{chunk-5PO5PKRV.mjs → chunk-7JZXMDDF.mjs} +158 -67
- package/dist/chunks/chunk-AEAJDCVK.mjs +517 -0
- package/dist/chunks/{chunk-6VQEXLE2.mjs → chunk-BHY7QDCM.mjs} +41 -3
- package/dist/chunks/{chunk-CD3ATSXE.mjs → chunk-BR3AD5QZ.mjs} +8 -2
- package/dist/chunks/chunk-BS3USVEA.mjs +301 -0
- package/dist/chunks/chunk-C2S64Y6F.mjs +203 -0
- package/dist/chunks/chunk-D7A77SNL.mjs +976 -0
- package/dist/chunks/chunk-DDTTSKGG.mjs +2443 -0
- package/dist/chunks/{chunk-VAUOM3IN.mjs → chunk-DLWCKKIO.mjs} +1 -1
- package/dist/chunks/{chunk-G6PH7RPW.mjs → chunk-E7LC6SHP.mjs} +3 -3
- package/dist/chunks/{chunk-ZESQMP66.mjs → chunk-F3WSCAJD.mjs} +3 -3
- package/dist/chunks/{chunk-KXEF4F4E.mjs → chunk-GAZO6UMI.mjs} +1 -1
- package/dist/chunks/{chunk-XYTWGHFS.mjs → chunk-H3XLRWVE.mjs} +1 -1
- package/dist/chunks/{chunk-7T2YMTWL.mjs → chunk-H4C65MTP.mjs} +4 -4
- package/dist/chunks/chunk-HBOFZRUS.mjs +738 -0
- package/dist/chunks/{chunk-VN7UH7I5.mjs → chunk-IMVMSU3A.mjs} +251 -68
- package/dist/chunks/{chunk-XYV3VCIX.mjs → chunk-JZFONJSL.mjs} +79 -20
- package/dist/chunks/chunk-KCIRFUZH.mjs +12799 -0
- package/dist/chunks/chunk-KDDVQKCG.mjs +65 -0
- package/dist/chunks/chunk-KRPKWOMB.mjs +290 -0
- package/dist/chunks/chunk-LKFHERRV.mjs +145 -0
- package/dist/chunks/chunk-LTX74NU6.mjs +29 -0
- package/dist/chunks/{chunk-HSBV6YFU.mjs → chunk-LVF2DRBR.mjs} +634 -99
- package/dist/chunks/chunk-M2F7C2UJ.mjs +425 -0
- package/dist/chunks/{chunk-62NE4LG4.mjs → chunk-MQAMI5BF.mjs} +5 -5
- package/dist/chunks/chunk-MZRXFWPQ.mjs +278 -0
- package/dist/chunks/{chunk-PRMGZZM5.mjs → chunk-NZLEPJ5M.mjs} +2 -0
- package/dist/chunks/{chunk-I3UYSITV.mjs → chunk-O7XKQ6CH.mjs} +1 -1
- package/dist/chunks/chunk-P3RG5LQA.mjs +244 -0
- package/dist/chunks/chunk-PAK5JCO2.mjs +48 -0
- package/dist/chunks/chunk-PC63YFB7.mjs +34 -0
- package/dist/chunks/{daemon-control-HKFVSQTQ.mjs → chunk-RHBGCOS3.mjs} +67 -26
- package/dist/chunks/{chunk-J74STFKE.mjs → chunk-RJDOVMM4.mjs} +362 -58
- package/dist/chunks/{chunk-QPLEAE6V.mjs → chunk-SOSPQPEN.mjs} +167 -650
- package/dist/chunks/{chunk-LFMB4PAA.mjs → chunk-TKXIH27X.mjs} +974 -113
- package/dist/chunks/{chunk-5W7KES6P.mjs → chunk-UZPDETEU.mjs} +1 -1
- package/dist/chunks/chunk-V3MM6PCH.mjs +366 -0
- package/dist/chunks/chunk-VENQBMOA.mjs +62 -0
- package/dist/chunks/chunk-WJGPNHGX.mjs +67 -0
- package/dist/chunks/{chunk-Y5ZLKFLE.mjs → chunk-XNNJQCZP.mjs} +196 -165
- package/dist/chunks/{chunk-HDBPBORT.mjs → chunk-YRBFIDLB.mjs} +46 -10
- package/dist/chunks/{chunk-BNXUAOO4.mjs → chunk-ZGXUOAWZ.mjs} +3186 -959
- package/dist/chunks/chunk-ZPB3HYM7.mjs +45 -0
- package/dist/chunks/claude-subscription-EB4LAAVV.mjs +29 -0
- package/dist/chunks/{cli-NMFIAR7Z.mjs → cli-PCVFB6B4.mjs} +797 -56
- package/dist/chunks/{commands-KPJWFRUE.mjs → commands-KOMPXJZS.mjs} +4 -3
- package/dist/chunks/{daemon-YDIK3AAM.mjs → daemon-BVDB565V.mjs} +83142 -64424
- package/dist/chunks/daemon-control-MKN7G5M3.mjs +59 -0
- package/dist/chunks/{daemon-token-WRSULP7G.mjs → daemon-token-L5QKTHU5.mjs} +3 -1
- package/dist/chunks/{discord-DSP4HUWI.mjs → discord-IR62565M.mjs} +3 -52
- package/dist/chunks/{email-BRG7KUO2.mjs → email-KHHTJBDW.mjs} +4 -2
- package/dist/chunks/{grok-subscription-4PYX7TBF.mjs → grok-subscription-E74FS5EG.mjs} +5 -2
- package/dist/chunks/{layout-EPJQNFAI.mjs → layout-ECWGJF6M.mjs} +2 -2
- package/dist/chunks/{lib-N7FCZWKH.mjs → lib-L27L5PXM.mjs} +22 -22
- package/dist/chunks/{open-VAU7PXT6.mjs → open-3OR6WT4T.mjs} +6 -6
- package/dist/chunks/{parser-JVY2PWSM.mjs → parser-7GARNT5L.mjs} +1 -1
- package/dist/chunks/{pipeline-executor-O77NTGLP.mjs → pipeline-executor-DRYEEFDR.mjs} +6 -5
- package/dist/chunks/prompt-RRHZX4YT.mjs +13 -0
- package/dist/chunks/remote-access-cli-GLEEP7DI.mjs +268 -0
- package/dist/chunks/remote-hello-UFWUBDQI.mjs +37 -0
- package/dist/chunks/sdk-OJOAF4DP.mjs +30014 -0
- package/dist/chunks/{slack-OCNNF4DX.mjs → slack-IYC5RAB5.mjs} +3 -4
- package/dist/chunks/{store-HUVDJPYN.mjs → store-55CQSAOX.mjs} +7 -3
- package/dist/chunks/tailscale-WLJATFMB.mjs +25 -0
- package/dist/chunks/{theme-SFE3JMA2.mjs → theme-HLBDTF6F.mjs} +1 -1
- package/dist/chunks/{themes-YLXLOIJF.mjs → themes-BQ72P446.mjs} +2 -2
- package/dist/chunks/{token-6G3HCMNX.mjs → token-6D22WECM.mjs} +20 -16
- package/dist/chunks/{token-util-UXYSDQIW.mjs → token-util-YF3ZWBZ4.mjs} +1 -2
- package/dist/chunks/{tui-UQJLK7XI.mjs → tui-RAUVFOYY.mjs} +21 -18
- package/dist/chunks/{welcome-XHXFV7SH.mjs → welcome-J5JZZAM5.mjs} +1 -1
- package/dist/chunks/{whatsapp-AJMRQBT7.mjs → whatsapp-YJFFVN4Q.mjs} +9 -9
- package/package.json +1 -1
- package/dist/chunks/chunk-GKKCMXIZ.mjs +0 -94
- package/dist/chunks/chunk-IHDDCZBS.mjs +0 -112
- package/dist/chunks/chunk-KWFOS5WC.mjs +0 -41
- package/dist/chunks/chunk-UEZR2CNS.mjs +0 -65
- package/dist/chunks/chunk-VMHTYDH4.mjs +0 -172
- package/dist/chunks/chunk-Y2QA53AN.mjs +0 -259
- package/dist/chunks/{chunk-NBTUWMGP.mjs → chunk-2MTE22CR.mjs} +3 -3
- package/dist/chunks/{chunk-APRU6PHC.mjs → chunk-JZ7AQNPM.mjs} +3 -3
- package/dist/chunks/{telegram-2EFGKIVK.mjs → telegram-JYY2VDTI.mjs} +5 -5
|
@@ -1,172 +0,0 @@
|
|
|
1
|
-
import { createRequire as __adfCreateRequire } from 'node:module';
|
|
2
|
-
import { fileURLToPath as __adfFileURLToPath } from 'node:url';
|
|
3
|
-
import { dirname as __adfDirname } from 'node:path';
|
|
4
|
-
const require = __adfCreateRequire(import.meta.url);
|
|
5
|
-
const __filename = __adfFileURLToPath(import.meta.url);
|
|
6
|
-
const __dirname = __adfDirname(__filename);
|
|
7
|
-
import {
|
|
8
|
-
__export
|
|
9
|
-
} from "./chunk-M2RX3S2T.mjs";
|
|
10
|
-
|
|
11
|
-
// src/shared/utils/mcp-config.ts
|
|
12
|
-
var mcp_config_exports = {};
|
|
13
|
-
__export(mcp_config_exports, {
|
|
14
|
-
MCP_EXECUTABLE_IDENTITY_FIELDS: () => MCP_EXECUTABLE_IDENTITY_FIELDS,
|
|
15
|
-
buildEnvSchemaFromKeys: () => buildEnvSchemaFromKeys,
|
|
16
|
-
buildHeaderEnvSchemaFromEntries: () => buildHeaderEnvSchemaFromEntries,
|
|
17
|
-
buildMcpServerConfigFromRegistration: () => buildMcpServerConfigFromRegistration,
|
|
18
|
-
deriveRegistrationTestPlan: () => deriveRegistrationTestPlan,
|
|
19
|
-
getMcpRegistrationEnvKeys: () => getMcpRegistrationEnvKeys,
|
|
20
|
-
isRegistrationAgentVisible: () => isRegistrationAgentVisible,
|
|
21
|
-
isSensitiveMcpHeader: () => isSensitiveMcpHeader,
|
|
22
|
-
mcpCredentialNamespace: () => mcpCredentialNamespace,
|
|
23
|
-
mcpCredentialRef: () => mcpCredentialRef,
|
|
24
|
-
pinServerConfigToRegistration: () => pinServerConfigToRegistration,
|
|
25
|
-
reconcileHostApprovedRegistrations: () => reconcileHostApprovedRegistrations,
|
|
26
|
-
registrationSourceIdentity: () => registrationSourceIdentity,
|
|
27
|
-
sameExecutableIdentity: () => sameExecutableIdentity,
|
|
28
|
-
suggestedAgentVisible: () => suggestedAgentVisible
|
|
29
|
-
});
|
|
30
|
-
function sourcePackage(source) {
|
|
31
|
-
let s = source;
|
|
32
|
-
return s.npm_package ?? s.npmPackage ?? s.pypi_package ?? s.pypiPackage;
|
|
33
|
-
}
|
|
34
|
-
function mcpCredentialNamespace(source) {
|
|
35
|
-
return sourcePackage(source) ?? source.name;
|
|
36
|
-
}
|
|
37
|
-
function mcpCredentialRef(source, key) {
|
|
38
|
-
return `mcp:${mcpCredentialNamespace(source)}:${key}`;
|
|
39
|
-
}
|
|
40
|
-
function isSensitiveMcpHeader(header) {
|
|
41
|
-
let normalized = header.trim().toLowerCase();
|
|
42
|
-
return normalized === "authorization" || normalized === "proxy-authorization" || normalized === "x-api-key" || normalized === "api-key" || normalized === "apikey" || normalized === "x-auth-token" || normalized === "x-access-token" || normalized.includes("token") || normalized.includes("secret") || normalized.includes("credential");
|
|
43
|
-
}
|
|
44
|
-
function buildEnvSchemaFromKeys(source, keys, scope, requiredKeys = keys) {
|
|
45
|
-
let required = new Set(requiredKeys);
|
|
46
|
-
return [...new Set(keys.filter(Boolean))].map((key) => ({
|
|
47
|
-
key,
|
|
48
|
-
scope,
|
|
49
|
-
required: required.has(key) || void 0,
|
|
50
|
-
credential_ref: scope === "app" ? mcpCredentialRef(source, key) : void 0
|
|
51
|
-
}));
|
|
52
|
-
}
|
|
53
|
-
function buildHeaderEnvSchemaFromEntries(source, entries, appScoped = !0) {
|
|
54
|
-
return entries.filter((entry) => entry.header && entry.env).map((entry) => ({
|
|
55
|
-
header: entry.header,
|
|
56
|
-
env: entry.env,
|
|
57
|
-
required: !0,
|
|
58
|
-
credential_ref: appScoped ? mcpCredentialRef(source, entry.env) : void 0
|
|
59
|
-
}));
|
|
60
|
-
}
|
|
61
|
-
function getMcpRegistrationEnvKeys(registration) {
|
|
62
|
-
return [.../* @__PURE__ */ new Set([
|
|
63
|
-
...(registration.env ?? []).map((entry) => entry.key).filter(Boolean),
|
|
64
|
-
...registration.bearerTokenEnvVar ? [registration.bearerTokenEnvVar] : [],
|
|
65
|
-
...(registration.headerEnv ?? []).map((entry) => entry.value).filter(Boolean)
|
|
66
|
-
])];
|
|
67
|
-
}
|
|
68
|
-
function buildMcpServerConfigFromRegistration(registration) {
|
|
69
|
-
let isHttp = registration.type === "http" || !!registration.url, serverCfg = {
|
|
70
|
-
name: registration.name,
|
|
71
|
-
transport: isHttp ? "http" : "stdio"
|
|
72
|
-
};
|
|
73
|
-
if (isHttp) {
|
|
74
|
-
serverCfg.url = registration.url, serverCfg.source = registration.url ? `http:${registration.url}` : "http";
|
|
75
|
-
let staticHeaders = {};
|
|
76
|
-
for (let { key, value } of registration.headers ?? [])
|
|
77
|
-
key && value && !isSensitiveMcpHeader(key) && (staticHeaders[key] = value);
|
|
78
|
-
Object.keys(staticHeaders).length && (serverCfg.headers = staticHeaders), registration.headerEnv?.length && (serverCfg.header_env = buildHeaderEnvSchemaFromEntries(
|
|
79
|
-
registration,
|
|
80
|
-
registration.headerEnv.map(({ key, value }) => ({ header: key, env: value })),
|
|
81
|
-
(registration.credentialStorage ?? "app") !== "agent"
|
|
82
|
-
)), registration.oauth ? serverCfg.oauth = !0 : registration.bearerTokenEnvVar && (serverCfg.bearer_token_env_var = registration.bearerTokenEnvVar);
|
|
83
|
-
} else registration.npmPackage ? (serverCfg.source = `npm:${registration.npmPackage}`, serverCfg.npm_package = registration.npmPackage) : registration.pypiPackage ? (serverCfg.source = `uvx:${registration.pypiPackage}`, serverCfg.pypi_package = registration.pypiPackage) : (serverCfg.source = "custom", serverCfg.command = registration.command, serverCfg.args = registration.args);
|
|
84
|
-
isHttp || (registration.command && (serverCfg.command = registration.command), registration.args?.length && (serverCfg.args = registration.args));
|
|
85
|
-
let envKeys = getMcpRegistrationEnvKeys(registration);
|
|
86
|
-
if (envKeys.length) {
|
|
87
|
-
let scope = (registration.credentialStorage ?? "app") === "agent" ? "agent" : "app";
|
|
88
|
-
scope === "agent" && (serverCfg.env_keys = envKeys), serverCfg.env_schema = buildEnvSchemaFromKeys(registration, envKeys, scope);
|
|
89
|
-
}
|
|
90
|
-
return registration.toolCallTimeout && (serverCfg.tool_call_timeout_ms = registration.toolCallTimeout * 1e3), !isHttp && registration.runLocation && (serverCfg.run_location = registration.runLocation), registration.credentialFiles?.length && (serverCfg.credential_files = registration.credentialFiles.map((f) => ({
|
|
91
|
-
path: f.path,
|
|
92
|
-
...f.required !== void 0 ? { required: f.required } : {},
|
|
93
|
-
...f.writeBack !== void 0 ? { write_back: f.writeBack } : {}
|
|
94
|
-
}))), serverCfg;
|
|
95
|
-
}
|
|
96
|
-
function pinServerConfigToRegistration(connCfg, registration) {
|
|
97
|
-
let canonical = buildMcpServerConfigFromRegistration(registration), agentEnvSchema = (connCfg.env_schema ?? []).filter((e) => e.scope === "agent"), mergedEnvSchema = [
|
|
98
|
-
...canonical.env_schema ?? [],
|
|
99
|
-
...agentEnvSchema.filter(
|
|
100
|
-
(a) => !(canonical.env_schema ?? []).some((c) => c.key === a.key && c.scope === a.scope)
|
|
101
|
-
)
|
|
102
|
-
];
|
|
103
|
-
return {
|
|
104
|
-
...canonical,
|
|
105
|
-
// Agent-owned state kept from the .adf copy:
|
|
106
|
-
env: connCfg.env,
|
|
107
|
-
env_keys: connCfg.env_keys,
|
|
108
|
-
available_tools: connCfg.available_tools,
|
|
109
|
-
restricted: connCfg.restricted,
|
|
110
|
-
...mergedEnvSchema.length ? { env_schema: mergedEnvSchema } : {}
|
|
111
|
-
};
|
|
112
|
-
}
|
|
113
|
-
function suggestedAgentVisible(reg) {
|
|
114
|
-
return reg.type === "http" || !!reg.url ? !0 : reg.runLocation !== "host";
|
|
115
|
-
}
|
|
116
|
-
function isRegistrationAgentVisible(reg) {
|
|
117
|
-
return reg.agentVisible ?? suggestedAgentVisible(reg);
|
|
118
|
-
}
|
|
119
|
-
var MCP_EXECUTABLE_IDENTITY_FIELDS = ["type", "url", "command", "args", "npmPackage", "pypiPackage"];
|
|
120
|
-
function sameExecutableIdentity(a, b) {
|
|
121
|
-
let argsA = a.args ?? [], argsB = b.args ?? [];
|
|
122
|
-
return a.type === b.type && a.url === b.url && a.command === b.command && a.npmPackage === b.npmPackage && a.pypiPackage === b.pypiPackage && argsA.length === argsB.length && argsA.every((arg, i) => arg === argsB[i]);
|
|
123
|
-
}
|
|
124
|
-
function deriveRegistrationTestPlan(reg, opts) {
|
|
125
|
-
if (reg.type === "http" || !!reg.url) {
|
|
126
|
-
let notes2 = reg.oauth ? ["Interactive OAuth sign-in runs in a browser during this test."] : [];
|
|
127
|
-
return { location: "remote http", authMode: reg.oauth ? "run" : "none", materializeFiles: !1, notes: notes2 };
|
|
128
|
-
}
|
|
129
|
-
if (reg.runLocation === "host") {
|
|
130
|
-
if (!opts?.hostAccessEnabled) {
|
|
131
|
-
let notes2 = ["Host access is disabled app-wide \u2014 this test ran in the shared container. Enable host access in Settings \u2192 Compute to test on the host."];
|
|
132
|
-
return reg.auth && notes2.push("Authorization for containerized servers happens per-agent when an agent attaches this server."), { location: "shared container", authMode: reg.auth ? "skip" : "none", materializeFiles: !1, notes: notes2 };
|
|
133
|
-
}
|
|
134
|
-
return {
|
|
135
|
-
location: "host",
|
|
136
|
-
authMode: reg.auth ? "run" : "none",
|
|
137
|
-
materializeFiles: !0,
|
|
138
|
-
notes: []
|
|
139
|
-
};
|
|
140
|
-
}
|
|
141
|
-
let notes = [];
|
|
142
|
-
return reg.auth && notes.push("Authorization for containerized servers happens per-agent when an agent attaches this server."), reg.credentialFiles?.length && notes.push("Credential files for containerized servers are captured per-agent at attach; this test verifies the package launches and lists tools."), { location: "shared container", authMode: reg.auth ? "skip" : "none", materializeFiles: !1, notes };
|
|
143
|
-
}
|
|
144
|
-
function registrationSourceIdentity(reg) {
|
|
145
|
-
return reg.type === "http" || reg.url ? reg.url ? `http:${reg.url}` : "http" : reg.npmPackage ? `npm:${reg.npmPackage}` : reg.pypiPackage ? `uvx:${reg.pypiPackage}` : "custom";
|
|
146
|
-
}
|
|
147
|
-
function reconcileHostApprovedRegistrations(prev, next, approved, approvedSources) {
|
|
148
|
-
let result = [...approved], sources = { ...approvedSources ?? {} }, prevByName = new Map(prev.filter((r) => r.name).map((r) => [r.name, r])), nextByName = new Map(next.filter((r) => r.name).map((r) => [r.name, r])), add = (name, reg) => {
|
|
149
|
-
result.includes(name) || result.push(name), sources[name] = registrationSourceIdentity(reg);
|
|
150
|
-
}, remove = (name) => {
|
|
151
|
-
let i = result.indexOf(name);
|
|
152
|
-
i >= 0 && result.splice(i, 1), delete sources[name];
|
|
153
|
-
};
|
|
154
|
-
for (let [name, reg] of nextByName) {
|
|
155
|
-
let wasHost = prevByName.get(name)?.runLocation === "host", isHost = reg.runLocation === "host" && reg.type !== "http";
|
|
156
|
-
isHost && !wasHost ? add(name, reg) : !isHost && wasHost ? remove(name) : isHost && wasHost && result.includes(name) && (sources[name] = registrationSourceIdentity(reg));
|
|
157
|
-
}
|
|
158
|
-
for (let [name, reg] of prevByName)
|
|
159
|
-
!nextByName.has(name) && reg.runLocation === "host" && remove(name);
|
|
160
|
-
return { approved: result, sources };
|
|
161
|
-
}
|
|
162
|
-
|
|
163
|
-
export {
|
|
164
|
-
mcpCredentialRef,
|
|
165
|
-
isSensitiveMcpHeader,
|
|
166
|
-
buildEnvSchemaFromKeys,
|
|
167
|
-
buildHeaderEnvSchemaFromEntries,
|
|
168
|
-
buildMcpServerConfigFromRegistration,
|
|
169
|
-
pinServerConfigToRegistration,
|
|
170
|
-
isRegistrationAgentVisible,
|
|
171
|
-
mcp_config_exports
|
|
172
|
-
};
|
|
@@ -1,259 +0,0 @@
|
|
|
1
|
-
import { createRequire as __adfCreateRequire } from 'node:module';
|
|
2
|
-
import { fileURLToPath as __adfFileURLToPath } from 'node:url';
|
|
3
|
-
import { dirname as __adfDirname } from 'node:path';
|
|
4
|
-
const require = __adfCreateRequire(import.meta.url);
|
|
5
|
-
const __filename = __adfFileURLToPath(import.meta.url);
|
|
6
|
-
const __dirname = __adfDirname(__filename);
|
|
7
|
-
import {
|
|
8
|
-
__export
|
|
9
|
-
} from "./chunk-M2RX3S2T.mjs";
|
|
10
|
-
|
|
11
|
-
// src/main/utils/ssrf-guard.ts
|
|
12
|
-
import { lookup } from "node:dns/promises";
|
|
13
|
-
import { isIP } from "node:net";
|
|
14
|
-
var ALLOWED_FETCH_PROTOCOLS = /* @__PURE__ */ new Set(["http:", "https:"]), ALLOWED_CONNECT_PROTOCOLS = /* @__PURE__ */ new Set(["ws:", "wss:", "http:", "https:"]);
|
|
15
|
-
function parseLooseIPv4(host) {
|
|
16
|
-
let parts = host.split(".");
|
|
17
|
-
if (parts.length < 1 || parts.length > 4) return null;
|
|
18
|
-
let nums = [];
|
|
19
|
-
for (let part of parts) {
|
|
20
|
-
if (part === "") return null;
|
|
21
|
-
let n;
|
|
22
|
-
if (/^0[xX][0-9a-fA-F]+$/.test(part)) n = parseInt(part.slice(2), 16);
|
|
23
|
-
else if (/^0[0-7]+$/.test(part)) n = parseInt(part.slice(1), 8);
|
|
24
|
-
else if (/^[0-9]+$/.test(part)) n = parseInt(part, 10);
|
|
25
|
-
else return null;
|
|
26
|
-
if (!Number.isFinite(n) || n < 0) return null;
|
|
27
|
-
nums.push(n);
|
|
28
|
-
}
|
|
29
|
-
for (let i = 0; i < nums.length - 1; i++) if (nums[i] > 255) return null;
|
|
30
|
-
let last = nums[nums.length - 1];
|
|
31
|
-
if (last >= Math.pow(256, 4 - nums.length + 1)) return null;
|
|
32
|
-
let value = last;
|
|
33
|
-
for (let i = 0; i < nums.length - 1; i++) value += nums[i] * Math.pow(256, 3 - i);
|
|
34
|
-
return [value >>> 24 & 255, value >>> 16 & 255, value >>> 8 & 255, value & 255].join(".");
|
|
35
|
-
}
|
|
36
|
-
function isBlockedIPv4(ip) {
|
|
37
|
-
let o = ip.split(".").map(Number);
|
|
38
|
-
if (o.length !== 4 || o.some((n) => !Number.isInteger(n) || n < 0 || n > 255)) return !1;
|
|
39
|
-
let [a, b, c] = o;
|
|
40
|
-
return a === 0 || a === 10 || a === 127 || a === 100 && b >= 64 && b <= 127 || a === 169 && b === 254 || a === 172 && b >= 16 && b <= 31 || a === 192 && b === 0 && c === 0 || a === 192 && b === 168 || a === 198 && (b === 18 || b === 19) || a >= 224;
|
|
41
|
-
}
|
|
42
|
-
function isBlockedIPv6(raw) {
|
|
43
|
-
let addr = raw.toLowerCase().replace(/^\[|\]$/g, "").split("%")[0];
|
|
44
|
-
if (addr === "::" || addr === "::1" || /^(0:){7}[01]$/.test(addr)) return !0;
|
|
45
|
-
let mapped = addr.match(/^::(?:ffff:(?:0{1,4}:)?)?((?:\d{1,3}\.){3}\d{1,3})$/);
|
|
46
|
-
if (mapped) return isBlockedIPv4(mapped[1]);
|
|
47
|
-
let head = addr.split(":")[0];
|
|
48
|
-
if (!head) return !1;
|
|
49
|
-
let h = parseInt(head, 16);
|
|
50
|
-
return Number.isNaN(h) ? !1 : (h & 65472) === 65152 || (h & 65024) === 64512 || (h & 65280) === 65280;
|
|
51
|
-
}
|
|
52
|
-
function isBlockedIpAddress(ip) {
|
|
53
|
-
let version = isIP(ip.replace(/^\[|\]$/g, ""));
|
|
54
|
-
return version === 4 ? isBlockedIPv4(ip) : version === 6 ? isBlockedIPv6(ip) : !1;
|
|
55
|
-
}
|
|
56
|
-
function isLinkLocalIp(ip) {
|
|
57
|
-
let bare = ip.replace(/^\[|\]$/g, "").split("%")[0], version = isIP(bare);
|
|
58
|
-
if (version === 4) {
|
|
59
|
-
let o = bare.split(".").map(Number);
|
|
60
|
-
return o[0] === 169 && o[1] === 254;
|
|
61
|
-
}
|
|
62
|
-
if (version === 6) {
|
|
63
|
-
let addr = bare.toLowerCase(), mapped = addr.match(/^::(?:ffff:(?:0{1,4}:)?)?((?:\d{1,3}\.){3}\d{1,3})$/);
|
|
64
|
-
if (mapped) {
|
|
65
|
-
let o = mapped[1].split(".").map(Number);
|
|
66
|
-
return o[0] === 169 && o[1] === 254;
|
|
67
|
-
}
|
|
68
|
-
let head = addr.split(":")[0], h = parseInt(head, 16);
|
|
69
|
-
return Number.isNaN(h) ? !1 : (h & 65472) === 65152;
|
|
70
|
-
}
|
|
71
|
-
return !1;
|
|
72
|
-
}
|
|
73
|
-
function isLoopbackIp(ip) {
|
|
74
|
-
let bare = ip.replace(/^\[|\]$/g, "").split("%")[0], version = isIP(bare);
|
|
75
|
-
if (version === 4) return bare.split(".").map(Number)[0] === 127;
|
|
76
|
-
if (version === 6) {
|
|
77
|
-
let addr = bare.toLowerCase();
|
|
78
|
-
if (addr === "::1" || /^(0:){7}1$/.test(addr)) return !0;
|
|
79
|
-
let mapped = addr.match(/^::(?:ffff:(?:0{1,4}:)?)?((?:\d{1,3}\.){3}\d{1,3})$/);
|
|
80
|
-
return mapped ? mapped[1].split(".").map(Number)[0] === 127 : !1;
|
|
81
|
-
}
|
|
82
|
-
return !1;
|
|
83
|
-
}
|
|
84
|
-
function isLoopbackHostname(host) {
|
|
85
|
-
let h = host.toLowerCase().replace(/\.$/, "");
|
|
86
|
-
return h === "localhost" || h === "localhost.localdomain" || h.endsWith(".localhost");
|
|
87
|
-
}
|
|
88
|
-
function isUnspecifiedIp(ip) {
|
|
89
|
-
let bare = ip.replace(/^\[|\]$/g, "").split("%")[0].toLowerCase();
|
|
90
|
-
if (bare === "0.0.0.0" || bare === "::" || /^(0{1,4}:){7}0{1,4}$/.test(bare)) return !0;
|
|
91
|
-
let mapped = bare.match(/^::(?:ffff:(?:0{1,4}:)?)?((?:\d{1,3}\.){3}\d{1,3})$/);
|
|
92
|
-
return mapped ? mapped[1] === "0.0.0.0" : !1;
|
|
93
|
-
}
|
|
94
|
-
function blockedMessage(target) {
|
|
95
|
-
return `Blocked by the sys_fetch SSRF guard: "${target}" is a private-network address (loopback is allowed by default). Set security.allow_local_fetch: true in your config to permit private/LAN fetches \u2014 an agent-initiated write to that setting raises an owner approval request.`;
|
|
96
|
-
}
|
|
97
|
-
function connectBlockedMessage(target) {
|
|
98
|
-
return `Blocked by the ws_connect SSRF guard: "${target}" is a private-network address (loopback is allowed by default). Set security.allow_local_fetch: true in your config to permit private/LAN connections \u2014 an agent-initiated write to that setting raises an owner approval request.`;
|
|
99
|
-
}
|
|
100
|
-
async function classifyHost(host) {
|
|
101
|
-
let loopbackHost = !1, candidates = [];
|
|
102
|
-
if (isIP(host))
|
|
103
|
-
candidates = [host];
|
|
104
|
-
else if (isLoopbackHostname(host))
|
|
105
|
-
loopbackHost = !0;
|
|
106
|
-
else {
|
|
107
|
-
let loose = parseLooseIPv4(host);
|
|
108
|
-
if (loose)
|
|
109
|
-
candidates = [loose];
|
|
110
|
-
else
|
|
111
|
-
try {
|
|
112
|
-
candidates = (await lookup(host, { all: !0, verbatim: !0 })).map((a) => a.address);
|
|
113
|
-
} catch {
|
|
114
|
-
return null;
|
|
115
|
-
}
|
|
116
|
-
}
|
|
117
|
-
return {
|
|
118
|
-
anyLinkLocal: candidates.some(isLinkLocalIp),
|
|
119
|
-
anyLoopback: loopbackHost || candidates.some(isLoopbackIp),
|
|
120
|
-
anyUnspecified: candidates.some(isUnspecifiedIp),
|
|
121
|
-
// Blocked classes minus loopback (private, CGNAT, unspecified, multicast, …)
|
|
122
|
-
// — loopback itself is allowed by default and only tier-gated per-port.
|
|
123
|
-
anyNonLoopbackBlocked: candidates.some((ip) => isBlockedIpAddress(ip) && !isLoopbackIp(ip))
|
|
124
|
-
};
|
|
125
|
-
}
|
|
126
|
-
function applyPolicy(target, port, path, cls, opts, overridableMessage) {
|
|
127
|
-
return cls.anyLinkLocal ? `Blocked: "${target}" is a link-local / cloud-metadata address, which is never fetchable (even with allow_local_fetch).` : (cls.anyLoopback || cls.anyUnspecified) && opts.daemonPort && port === opts.daemonPort ? `Blocked: "${target}" (port ${port}) is the local ADF daemon control API, which is never fetchable, even with allow_local_fetch.` : opts.ownOrigin && cls.anyLoopback && port === opts.ownOrigin.port && path.startsWith(opts.ownOrigin.pathPrefix) || opts.allowLocal ? null : cls.anyNonLoopbackBlocked ? overridableMessage(target) : null;
|
|
128
|
-
}
|
|
129
|
-
async function checkFetchTarget(rawUrl, opts = { allowLocal: !1 }) {
|
|
130
|
-
let url;
|
|
131
|
-
try {
|
|
132
|
-
url = new URL(rawUrl);
|
|
133
|
-
} catch {
|
|
134
|
-
return `Invalid URL: ${rawUrl}`;
|
|
135
|
-
}
|
|
136
|
-
if (!ALLOWED_FETCH_PROTOCOLS.has(url.protocol))
|
|
137
|
-
return `Blocked by the sys_fetch guard: only http and https URLs may be fetched (got "${url.protocol}").`;
|
|
138
|
-
let host = url.hostname.replace(/^\[|\]$/g, "");
|
|
139
|
-
if (!host) return `Invalid URL: ${rawUrl}`;
|
|
140
|
-
let port = url.port ? Number(url.port) : url.protocol === "https:" ? 443 : 80, cls = await classifyHost(host);
|
|
141
|
-
return cls ? applyPolicy(url.hostname, port, url.pathname, cls, opts, blockedMessage) : null;
|
|
142
|
-
}
|
|
143
|
-
async function checkConnectTarget(rawUrl, opts = { allowLocal: !1 }) {
|
|
144
|
-
let url;
|
|
145
|
-
try {
|
|
146
|
-
url = new URL(rawUrl);
|
|
147
|
-
} catch {
|
|
148
|
-
return `Invalid URL: ${rawUrl}`;
|
|
149
|
-
}
|
|
150
|
-
if (!ALLOWED_CONNECT_PROTOCOLS.has(url.protocol))
|
|
151
|
-
return `Blocked by the ws_connect guard: only ws, wss, http and https URLs may be connected (got "${url.protocol}").`;
|
|
152
|
-
let host = url.hostname.replace(/^\[|\]$/g, "");
|
|
153
|
-
if (!host) return `Invalid URL: ${rawUrl}`;
|
|
154
|
-
let secure = url.protocol === "wss:" || url.protocol === "https:", port = url.port ? Number(url.port) : secure ? 443 : 80, cls = await classifyHost(host);
|
|
155
|
-
return cls ? applyPolicy(url.hostname, port, url.pathname, cls, opts, connectBlockedMessage) : null;
|
|
156
|
-
}
|
|
157
|
-
|
|
158
|
-
// src/shared/utils/context-breakdown.ts
|
|
159
|
-
var context_breakdown_exports = {};
|
|
160
|
-
__export(context_breakdown_exports, {
|
|
161
|
-
DEFAULT_COMPACT_THRESHOLD: () => DEFAULT_COMPACT_THRESHOLD,
|
|
162
|
-
contextCategories: () => contextCategories,
|
|
163
|
-
contextTotal: () => contextTotal,
|
|
164
|
-
resolveCompactThreshold: () => resolveCompactThreshold,
|
|
165
|
-
resolveHostThreshold: () => resolveHostThreshold,
|
|
166
|
-
resolveLoopThreshold: () => resolveLoopThreshold
|
|
167
|
-
});
|
|
168
|
-
var DEFAULT_COMPACT_THRESHOLD = 1e5;
|
|
169
|
-
function hostThreshold(config, model) {
|
|
170
|
-
let context = config?.context?.compact_threshold;
|
|
171
|
-
if (context != null) return { value: context, source: "agent" };
|
|
172
|
-
let fromModel = model?.compact_threshold;
|
|
173
|
-
return fromModel != null ? { value: fromModel, source: "model" } : { value: 1e5, source: "default" };
|
|
174
|
-
}
|
|
175
|
-
function resolveCompactThreshold(config, loop) {
|
|
176
|
-
if (!loop || loop === "main") return hostThreshold(config, config?.model);
|
|
177
|
-
let declared = config?.loops?.find((l) => l.name === loop);
|
|
178
|
-
return declared ? declared.compact_threshold != null ? { value: declared.compact_threshold, source: "loop" } : hostThreshold(config, declared.model ?? config?.model) : hostThreshold(config, config?.model);
|
|
179
|
-
}
|
|
180
|
-
function resolveHostThreshold(config) {
|
|
181
|
-
return resolveCompactThreshold(config).value;
|
|
182
|
-
}
|
|
183
|
-
function resolveLoopThreshold(config, loop) {
|
|
184
|
-
return resolveCompactThreshold(config, loop).value;
|
|
185
|
-
}
|
|
186
|
-
function contextTotal(b) {
|
|
187
|
-
return b.system_prompt_tokens + b.tools_total_tokens + b.messages_tokens + b.dynamic_instructions_tokens;
|
|
188
|
-
}
|
|
189
|
-
var byTokens = (list) => [...list].sort((a, b) => b.tokens - a.tokens);
|
|
190
|
-
function contextCategories(b, maxItems = 12) {
|
|
191
|
-
let fileTokens = b.injected_files.reduce((sum, f) => sum + f.tokens, 0), parts = b.system_prompt_parts, out = [
|
|
192
|
-
{
|
|
193
|
-
id: "system",
|
|
194
|
-
key: "system",
|
|
195
|
-
label: "System prompt",
|
|
196
|
-
tokens: Math.max(0, b.system_prompt_tokens - fileTokens),
|
|
197
|
-
items: parts ? byTokens([
|
|
198
|
-
{ name: "Base prompt and capability sections", tokens: parts.base_and_sections },
|
|
199
|
-
{ name: "Agent instructions", tokens: parts.instructions },
|
|
200
|
-
{ name: "Identity, loop roster, runtime blocks", tokens: parts.runtime_blocks }
|
|
201
|
-
]).filter((i) => i.tokens > 0) : [],
|
|
202
|
-
note: "Base prompt, instructions and runtime blocks: sent with every request."
|
|
203
|
-
}
|
|
204
|
-
];
|
|
205
|
-
b.injected_files.length > 0 && out.push({
|
|
206
|
-
id: "files",
|
|
207
|
-
key: "files",
|
|
208
|
-
label: "Injected files",
|
|
209
|
-
tokens: fileTokens,
|
|
210
|
-
count: b.injected_files.length,
|
|
211
|
-
items: byTokens(b.injected_files.map((f) => ({ name: f.path, tokens: f.tokens }))).slice(0, maxItems),
|
|
212
|
-
note: "{{path}} files rendered into the system prompt."
|
|
213
|
-
});
|
|
214
|
-
let builtIn = b.tool_groups.filter((g) => g.source === "built-in"), builtInTools = builtIn.flatMap((g) => g.tools);
|
|
215
|
-
out.push({
|
|
216
|
-
id: "tools",
|
|
217
|
-
key: "tools",
|
|
218
|
-
label: "Tools",
|
|
219
|
-
tokens: builtIn.reduce((sum, g) => sum + g.tokens, 0),
|
|
220
|
-
count: builtInTools.length,
|
|
221
|
-
items: byTokens(builtInTools).slice(0, maxItems),
|
|
222
|
-
note: "Built-in tool schemas: sent with every request."
|
|
223
|
-
});
|
|
224
|
-
for (let group of b.tool_groups)
|
|
225
|
-
group.source !== "built-in" && out.push({
|
|
226
|
-
id: `mcp:${group.source}`,
|
|
227
|
-
key: "mcp",
|
|
228
|
-
label: `MCP ${group.source}`,
|
|
229
|
-
tokens: group.tokens,
|
|
230
|
-
count: group.tools.length,
|
|
231
|
-
items: byTokens(group.tools).slice(0, maxItems),
|
|
232
|
-
note: `Tool schemas from the ${group.source} MCP server.`
|
|
233
|
-
});
|
|
234
|
-
return out.push({
|
|
235
|
-
id: "dynamic",
|
|
236
|
-
key: "dynamic",
|
|
237
|
-
label: "Dynamic instructions",
|
|
238
|
-
tokens: b.dynamic_instructions_tokens,
|
|
239
|
-
items: [],
|
|
240
|
-
note: "Per-turn runtime notes (context pressure, reminders)."
|
|
241
|
-
}), out.push({
|
|
242
|
-
id: "messages",
|
|
243
|
-
key: "messages",
|
|
244
|
-
label: "Conversation",
|
|
245
|
-
tokens: b.messages_tokens,
|
|
246
|
-
items: [],
|
|
247
|
-
note: "This loop\u2019s history, compaction summary included (estimate)."
|
|
248
|
-
}), byTokens(out);
|
|
249
|
-
}
|
|
250
|
-
|
|
251
|
-
export {
|
|
252
|
-
checkFetchTarget,
|
|
253
|
-
checkConnectTarget,
|
|
254
|
-
resolveCompactThreshold,
|
|
255
|
-
resolveLoopThreshold,
|
|
256
|
-
contextTotal,
|
|
257
|
-
contextCategories,
|
|
258
|
-
context_breakdown_exports
|
|
259
|
-
};
|
|
@@ -4,13 +4,13 @@ import { dirname as __adfDirname } from 'node:path';
|
|
|
4
4
|
const require = __adfCreateRequire(import.meta.url);
|
|
5
5
|
const __filename = __adfFileURLToPath(import.meta.url);
|
|
6
6
|
const __dirname = __adfDirname(__filename);
|
|
7
|
+
import {
|
|
8
|
+
fromBuffer
|
|
9
|
+
} from "./chunk-HBUENVQL.mjs";
|
|
7
10
|
import {
|
|
8
11
|
a2hex,
|
|
9
12
|
findZero
|
|
10
13
|
} from "./chunk-XX7OSWTO.mjs";
|
|
11
|
-
import {
|
|
12
|
-
fromBuffer
|
|
13
|
-
} from "./chunk-HBUENVQL.mjs";
|
|
14
14
|
import {
|
|
15
15
|
BasicParser,
|
|
16
16
|
FieldDecodingError,
|
|
@@ -4,13 +4,13 @@ import { dirname as __adfDirname } from 'node:path';
|
|
|
4
4
|
const require = __adfCreateRequire(import.meta.url);
|
|
5
5
|
const __filename = __adfFileURLToPath(import.meta.url);
|
|
6
6
|
const __dirname = __adfDirname(__filename);
|
|
7
|
-
import {
|
|
8
|
-
savePrefs
|
|
9
|
-
} from "./chunk-5QU5VY7N.mjs";
|
|
10
7
|
import {
|
|
11
8
|
setMouseWanted,
|
|
12
9
|
terminalCaps
|
|
13
10
|
} from "./chunk-7XYNI52E.mjs";
|
|
11
|
+
import {
|
|
12
|
+
savePrefs
|
|
13
|
+
} from "./chunk-5QU5VY7N.mjs";
|
|
14
14
|
|
|
15
15
|
// src/main/tui/app/layout.ts
|
|
16
16
|
var LAYOUT_STATE_KEY = "shell.layout";
|
|
@@ -7,6 +7,11 @@ const __dirname = __adfDirname(__filename);
|
|
|
7
7
|
import {
|
|
8
8
|
convertToOggOpus
|
|
9
9
|
} from "./chunk-BMNZ2VPS.mjs";
|
|
10
|
+
import {
|
|
11
|
+
require_src
|
|
12
|
+
} from "./chunk-AUYKRQPJ.mjs";
|
|
13
|
+
import "./chunk-NZ7JTHEO.mjs";
|
|
14
|
+
import "./chunk-3GNIDM53.mjs";
|
|
10
15
|
import {
|
|
11
16
|
require_safer
|
|
12
17
|
} from "./chunk-OQN33RGQ.mjs";
|
|
@@ -29,13 +34,8 @@ import {
|
|
|
29
34
|
encodeFormAction
|
|
30
35
|
} from "./chunk-M3WPIJYM.mjs";
|
|
31
36
|
import "./chunk-UYY5M2PB.mjs";
|
|
32
|
-
import {
|
|
33
|
-
require_src
|
|
34
|
-
} from "./chunk-AUYKRQPJ.mjs";
|
|
35
|
-
import "./chunk-NZ7JTHEO.mjs";
|
|
36
37
|
import "./chunk-ZJKXHM4Q.mjs";
|
|
37
38
|
import "./chunk-RIX34QHC.mjs";
|
|
38
|
-
import "./chunk-3GNIDM53.mjs";
|
|
39
39
|
import {
|
|
40
40
|
__commonJS,
|
|
41
41
|
__require,
|