@struktoai/mirage-browser 0.0.1-alpha.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 +230 -0
- package/dist/box-Y2SJWAAO.js +8 -0
- package/dist/box-Y2SJWAAO.js.map +1 -0
- package/dist/chunk-27UVUTJH.js +126 -0
- package/dist/chunk-27UVUTJH.js.map +1 -0
- package/dist/chunk-33SBWNB4.js +103 -0
- package/dist/chunk-33SBWNB4.js.map +1 -0
- package/dist/chunk-3PWPFOPS.js +88 -0
- package/dist/chunk-3PWPFOPS.js.map +1 -0
- package/dist/chunk-5Q5GJUAF.js +88 -0
- package/dist/chunk-5Q5GJUAF.js.map +1 -0
- package/dist/chunk-7GZXXXAS.js +24 -0
- package/dist/chunk-7GZXXXAS.js.map +1 -0
- package/dist/chunk-B4SYG2FD.js +24 -0
- package/dist/chunk-B4SYG2FD.js.map +1 -0
- package/dist/chunk-BIZONEJC.js +24 -0
- package/dist/chunk-BIZONEJC.js.map +1 -0
- package/dist/chunk-CQJTW45B.js +92 -0
- package/dist/chunk-CQJTW45B.js.map +1 -0
- package/dist/chunk-CZOTICOC.js +93 -0
- package/dist/chunk-CZOTICOC.js.map +1 -0
- package/dist/chunk-DDM2Z7YA.js +94 -0
- package/dist/chunk-DDM2Z7YA.js.map +1 -0
- package/dist/chunk-DPC7QRYO.js +99 -0
- package/dist/chunk-DPC7QRYO.js.map +1 -0
- package/dist/chunk-FL7YLP7D.js +107 -0
- package/dist/chunk-FL7YLP7D.js.map +1 -0
- package/dist/chunk-GFWWDQUZ.js +24 -0
- package/dist/chunk-GFWWDQUZ.js.map +1 -0
- package/dist/chunk-LG6GVNOL.js +94 -0
- package/dist/chunk-LG6GVNOL.js.map +1 -0
- package/dist/chunk-LSSB3AEW.js +94 -0
- package/dist/chunk-LSSB3AEW.js.map +1 -0
- package/dist/chunk-LUDXUYIA.js +89 -0
- package/dist/chunk-LUDXUYIA.js.map +1 -0
- package/dist/chunk-LZRPA2P7.js +99 -0
- package/dist/chunk-LZRPA2P7.js.map +1 -0
- package/dist/chunk-ML57VOCK.js +7590 -0
- package/dist/chunk-ML57VOCK.js.map +1 -0
- package/dist/chunk-MSNVGH6T.js +92 -0
- package/dist/chunk-MSNVGH6T.js.map +1 -0
- package/dist/chunk-NBWTZXH2.js +27 -0
- package/dist/chunk-NBWTZXH2.js.map +1 -0
- package/dist/chunk-ONQ5JGPR.js +96 -0
- package/dist/chunk-ONQ5JGPR.js.map +1 -0
- package/dist/chunk-OPROOV6J.js +24 -0
- package/dist/chunk-OPROOV6J.js.map +1 -0
- package/dist/chunk-QARIHW3I.js +23 -0
- package/dist/chunk-QARIHW3I.js.map +1 -0
- package/dist/chunk-QYFCHCGX.js +144 -0
- package/dist/chunk-QYFCHCGX.js.map +1 -0
- package/dist/chunk-SQQI4A6Y.js +94 -0
- package/dist/chunk-SQQI4A6Y.js.map +1 -0
- package/dist/chunk-UFXEZ56G.js +79 -0
- package/dist/chunk-UFXEZ56G.js.map +1 -0
- package/dist/chunk-UW3D2AF6.js +94 -0
- package/dist/chunk-UW3D2AF6.js.map +1 -0
- package/dist/chunk-UZWJ462U.js +93 -0
- package/dist/chunk-UZWJ462U.js.map +1 -0
- package/dist/chunk-VLFE4FGD.js +178 -0
- package/dist/chunk-VLFE4FGD.js.map +1 -0
- package/dist/chunk-XIURBEVZ.js +24 -0
- package/dist/chunk-XIURBEVZ.js.map +1 -0
- package/dist/chunk-ZJ6ROCTP.js +114 -0
- package/dist/chunk-ZJ6ROCTP.js.map +1 -0
- package/dist/config-4FABMWVK.js +9 -0
- package/dist/config-4FABMWVK.js.map +1 -0
- package/dist/config-DGIUMGBB.js +9 -0
- package/dist/config-DGIUMGBB.js.map +1 -0
- package/dist/config-G3TTNXLY.js +9 -0
- package/dist/config-G3TTNXLY.js.map +1 -0
- package/dist/config-GPCEEKCB.js +9 -0
- package/dist/config-GPCEEKCB.js.map +1 -0
- package/dist/config-KQ5VR2KZ.js +9 -0
- package/dist/config-KQ5VR2KZ.js.map +1 -0
- package/dist/config-LPMMVXLS.js +9 -0
- package/dist/config-LPMMVXLS.js.map +1 -0
- package/dist/config-U4UI4OKA.js +9 -0
- package/dist/config-U4UI4OKA.js.map +1 -0
- package/dist/config-VZGK63Z5.js +9 -0
- package/dist/config-VZGK63Z5.js.map +1 -0
- package/dist/discord-RG6URXXS.js +7 -0
- package/dist/discord-RG6URXXS.js.map +1 -0
- package/dist/dropbox-P7SOL7GN.js +8 -0
- package/dist/dropbox-P7SOL7GN.js.map +1 -0
- package/dist/gcs-2QHB4CBT.js +8 -0
- package/dist/gcs-2QHB4CBT.js.map +1 -0
- package/dist/gdocs-JNZTOZ33.js +8 -0
- package/dist/gdocs-JNZTOZ33.js.map +1 -0
- package/dist/gdrive-6MEIVN2F.js +8 -0
- package/dist/gdrive-6MEIVN2F.js.map +1 -0
- package/dist/github-M7WODJR2.js +7 -0
- package/dist/github-M7WODJR2.js.map +1 -0
- package/dist/github_ci-4XELEFSZ.js +8 -0
- package/dist/github_ci-4XELEFSZ.js.map +1 -0
- package/dist/gmail-AO6A3URH.js +8 -0
- package/dist/gmail-AO6A3URH.js.map +1 -0
- package/dist/gsheets-RFOKXMOJ.js +8 -0
- package/dist/gsheets-RFOKXMOJ.js.map +1 -0
- package/dist/gslides-GTVZPLLB.js +8 -0
- package/dist/gslides-GTVZPLLB.js.map +1 -0
- package/dist/index.d.ts +1127 -0
- package/dist/index.js +743 -0
- package/dist/index.js.map +1 -0
- package/dist/langfuse-CDOLELMB.js +7 -0
- package/dist/langfuse-CDOLELMB.js.map +1 -0
- package/dist/linear-SXOQGG6B.js +7 -0
- package/dist/linear-SXOQGG6B.js.map +1 -0
- package/dist/mongodb-HA7FAKDJ.js +7 -0
- package/dist/mongodb-HA7FAKDJ.js.map +1 -0
- package/dist/notion-ANZNMM3L.js +7 -0
- package/dist/notion-ANZNMM3L.js.map +1 -0
- package/dist/oci-ML5ZRVZ2.js +8 -0
- package/dist/oci-ML5ZRVZ2.js.map +1 -0
- package/dist/opfs-57XFMWWE.js +7 -0
- package/dist/opfs-57XFMWWE.js.map +1 -0
- package/dist/postgres-CK4HWZSL.js +7 -0
- package/dist/postgres-CK4HWZSL.js.map +1 -0
- package/dist/r2-56O4Q2J4.js +8 -0
- package/dist/r2-56O4Q2J4.js.map +1 -0
- package/dist/s3-A4XFE6QV.js +9 -0
- package/dist/s3-A4XFE6QV.js.map +1 -0
- package/dist/slack-QA7H7WLM.js +7 -0
- package/dist/slack-QA7H7WLM.js.map +1 -0
- package/dist/supabase-NNK2RWG3.js +8 -0
- package/dist/supabase-NNK2RWG3.js.map +1 -0
- package/dist/trello-H6PZT2IT.js +7 -0
- package/dist/trello-H6PZT2IT.js.map +1 -0
- package/package.json +74 -0
|
@@ -0,0 +1,88 @@
|
|
|
1
|
+
import {
|
|
2
|
+
S3Resource
|
|
3
|
+
} from "./chunk-VLFE4FGD.js";
|
|
4
|
+
|
|
5
|
+
// src/resource/oci/oci.ts
|
|
6
|
+
import { ResourceName } from "@struktoai/mirage-core";
|
|
7
|
+
|
|
8
|
+
// src/resource/oci/config.ts
|
|
9
|
+
function resolvedOciEndpoint(config) {
|
|
10
|
+
if (config.endpoint !== void 0 && config.endpoint !== "") return config.endpoint;
|
|
11
|
+
if (config.namespace !== void 0 && config.namespace !== "" && config.region !== void 0 && config.region !== "") {
|
|
12
|
+
return `https://${config.namespace}.compat.objectstorage.${config.region}.oci.customer-oci.com`;
|
|
13
|
+
}
|
|
14
|
+
return void 0;
|
|
15
|
+
}
|
|
16
|
+
function ociToS3Config(config) {
|
|
17
|
+
const endpoint = resolvedOciEndpoint(config);
|
|
18
|
+
return {
|
|
19
|
+
bucket: config.bucket,
|
|
20
|
+
presignedUrlProvider: config.presignedUrlProvider,
|
|
21
|
+
...config.region !== void 0 ? { region: config.region } : {},
|
|
22
|
+
...endpoint !== void 0 ? { endpoint } : {},
|
|
23
|
+
...config.defaultContentType !== void 0 ? { defaultContentType: config.defaultContentType } : {}
|
|
24
|
+
};
|
|
25
|
+
}
|
|
26
|
+
function redactOciConfig(config) {
|
|
27
|
+
return { ...config, presignedUrlProvider: "<REDACTED>" };
|
|
28
|
+
}
|
|
29
|
+
|
|
30
|
+
// src/resource/oci/prompt.ts
|
|
31
|
+
var OCI_BROWSER_PROMPT = `{prefix}
|
|
32
|
+
Remote Oracle Cloud Object Storage accessed via presigned URLs (browser runtime).
|
|
33
|
+
Supports the full filesystem command set: ls/tree/cat/grep/find/du/cp/mv/rm/etc.
|
|
34
|
+
Listing operations require the presigner to sign LIST/COPY operations in
|
|
35
|
+
addition to GET/PUT/HEAD/DELETE \u2014 see S3BrowserPresignedUrlProvider docs.`;
|
|
36
|
+
|
|
37
|
+
// src/resource/oci/oci.ts
|
|
38
|
+
function remapOpsResource(ops, to) {
|
|
39
|
+
return ops.map((op) => op.resource === ResourceName.S3 ? { ...op, resource: to } : op);
|
|
40
|
+
}
|
|
41
|
+
function remapCommandsResource(commands, to) {
|
|
42
|
+
return commands.map((cmd) => {
|
|
43
|
+
if (cmd.resource !== ResourceName.S3) return cmd;
|
|
44
|
+
const proto = Object.getPrototypeOf(cmd);
|
|
45
|
+
const copy = Object.assign(Object.create(proto), cmd);
|
|
46
|
+
Object.assign(copy, { resource: to });
|
|
47
|
+
return copy;
|
|
48
|
+
});
|
|
49
|
+
}
|
|
50
|
+
var OCIResource = class extends S3Resource {
|
|
51
|
+
kind = ResourceName.OCI;
|
|
52
|
+
prompt = OCI_BROWSER_PROMPT;
|
|
53
|
+
ociConfig;
|
|
54
|
+
ociOps;
|
|
55
|
+
ociCommands;
|
|
56
|
+
constructor(config) {
|
|
57
|
+
super(ociToS3Config(config));
|
|
58
|
+
this.ociConfig = config;
|
|
59
|
+
this.ociOps = remapOpsResource(super.ops(), ResourceName.OCI);
|
|
60
|
+
this.ociCommands = remapCommandsResource(super.commands(), ResourceName.OCI);
|
|
61
|
+
}
|
|
62
|
+
ops() {
|
|
63
|
+
return this.ociOps;
|
|
64
|
+
}
|
|
65
|
+
commands() {
|
|
66
|
+
return this.ociCommands;
|
|
67
|
+
}
|
|
68
|
+
getState() {
|
|
69
|
+
return Promise.resolve({
|
|
70
|
+
type: this.kind,
|
|
71
|
+
needsOverride: true,
|
|
72
|
+
redactedFields: ["presignedUrlProvider"],
|
|
73
|
+
config: redactOciConfig(this.ociConfig)
|
|
74
|
+
});
|
|
75
|
+
}
|
|
76
|
+
loadState(_state) {
|
|
77
|
+
return Promise.resolve();
|
|
78
|
+
}
|
|
79
|
+
};
|
|
80
|
+
|
|
81
|
+
export {
|
|
82
|
+
resolvedOciEndpoint,
|
|
83
|
+
ociToS3Config,
|
|
84
|
+
redactOciConfig,
|
|
85
|
+
OCI_BROWSER_PROMPT,
|
|
86
|
+
OCIResource
|
|
87
|
+
};
|
|
88
|
+
//# sourceMappingURL=chunk-5Q5GJUAF.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../src/resource/oci/oci.ts","../src/resource/oci/config.ts","../src/resource/oci/prompt.ts"],"sourcesContent":["// ========= Copyright 2026 @ Strukto.AI All Rights Reserved. =========\n// Licensed under the Apache License, Version 2.0 (the \"License\");\n// you may not use this file except in compliance with the License.\n// You may obtain a copy of the License at\n//\n// http://www.apache.org/licenses/LICENSE-2.0\n//\n// Unless required by applicable law or agreed to in writing, software\n// distributed under the License is distributed on an \"AS IS\" BASIS,\n// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n// See the License for the specific language governing permissions and\n// limitations under the License.\n// ========= Copyright 2026 @ Strukto.AI All Rights Reserved. =========\n\nimport { ResourceName, type RegisteredCommand, type RegisteredOp } from '@struktoai/mirage-core'\nimport { S3Resource } from '../s3/s3.ts'\nimport { ociToS3Config, redactOciConfig, type OCIConfig, type OCIConfigRedacted } from './config.ts'\nimport { OCI_BROWSER_PROMPT } from './prompt.ts'\n\nexport interface OCIResourceState {\n type: string\n needsOverride: boolean\n redactedFields: readonly string[]\n config: OCIConfigRedacted\n}\n\nfunction remapOpsResource(ops: readonly RegisteredOp[], to: string): RegisteredOp[] {\n return ops.map((op) => (op.resource === ResourceName.S3 ? { ...op, resource: to } : op))\n}\n\nfunction remapCommandsResource(\n commands: readonly RegisteredCommand[],\n to: string,\n): RegisteredCommand[] {\n return commands.map((cmd) => {\n if (cmd.resource !== ResourceName.S3) return cmd\n const proto = Object.getPrototypeOf(cmd) as object\n const copy = Object.assign(Object.create(proto) as RegisteredCommand, cmd)\n Object.assign(copy, { resource: to })\n return copy\n })\n}\n\nexport class OCIResource extends S3Resource {\n override readonly kind: string = ResourceName.OCI\n override readonly prompt: string = OCI_BROWSER_PROMPT\n readonly ociConfig: OCIConfig\n private readonly ociOps: readonly RegisteredOp[]\n private readonly ociCommands: readonly RegisteredCommand[]\n\n constructor(config: OCIConfig) {\n super(ociToS3Config(config))\n this.ociConfig = config\n this.ociOps = remapOpsResource(super.ops(), ResourceName.OCI)\n this.ociCommands = remapCommandsResource(super.commands(), ResourceName.OCI)\n }\n\n override ops(): readonly RegisteredOp[] {\n return this.ociOps\n }\n\n override commands(): readonly RegisteredCommand[] {\n return this.ociCommands\n }\n\n override getState(): Promise<OCIResourceState> {\n return Promise.resolve({\n type: this.kind,\n needsOverride: true,\n redactedFields: ['presignedUrlProvider'],\n config: redactOciConfig(this.ociConfig),\n })\n }\n\n override loadState(_state: OCIResourceState): Promise<void> {\n return Promise.resolve()\n }\n}\n","// ========= Copyright 2026 @ Strukto.AI All Rights Reserved. =========\n// Licensed under the Apache License, Version 2.0 (the \"License\");\n// you may not use this file except in compliance with the License.\n// You may obtain a copy of the License at\n//\n// http://www.apache.org/licenses/LICENSE-2.0\n//\n// Unless required by applicable law or agreed to in writing, software\n// distributed under the License is distributed on an \"AS IS\" BASIS,\n// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n// See the License for the specific language governing permissions and\n// limitations under the License.\n// ========= Copyright 2026 @ Strukto.AI All Rights Reserved. =========\n\nimport type { S3BrowserPresignedUrlProvider, S3Config } from '../s3/config.ts'\n\nexport interface OCIConfig {\n bucket: string\n presignedUrlProvider: S3BrowserPresignedUrlProvider\n namespace?: string\n region?: string\n endpoint?: string\n defaultContentType?: string\n}\n\nexport interface OCIConfigRedacted extends Omit<OCIConfig, 'presignedUrlProvider'> {\n presignedUrlProvider: '<REDACTED>'\n}\n\nexport function resolvedOciEndpoint(config: OCIConfig): string | undefined {\n if (config.endpoint !== undefined && config.endpoint !== '') return config.endpoint\n if (\n config.namespace !== undefined &&\n config.namespace !== '' &&\n config.region !== undefined &&\n config.region !== ''\n ) {\n return `https://${config.namespace}.compat.objectstorage.${config.region}.oci.customer-oci.com`\n }\n return undefined\n}\n\nexport function ociToS3Config(config: OCIConfig): S3Config {\n const endpoint = resolvedOciEndpoint(config)\n return {\n bucket: config.bucket,\n presignedUrlProvider: config.presignedUrlProvider,\n ...(config.region !== undefined ? { region: config.region } : {}),\n ...(endpoint !== undefined ? { endpoint } : {}),\n ...(config.defaultContentType !== undefined\n ? { defaultContentType: config.defaultContentType }\n : {}),\n }\n}\n\nexport function redactOciConfig(config: OCIConfig): OCIConfigRedacted {\n return { ...config, presignedUrlProvider: '<REDACTED>' }\n}\n","// ========= Copyright 2026 @ Strukto.AI All Rights Reserved. =========\n// Licensed under the Apache License, Version 2.0 (the \"License\");\n// you may not use this file except in compliance with the License.\n// You may obtain a copy of the License at\n//\n// http://www.apache.org/licenses/LICENSE-2.0\n//\n// Unless required by applicable law or agreed to in writing, software\n// distributed under the License is distributed on an \"AS IS\" BASIS,\n// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n// See the License for the specific language governing permissions and\n// limitations under the License.\n// ========= Copyright 2026 @ Strukto.AI All Rights Reserved. =========\n\nexport const OCI_BROWSER_PROMPT = `{prefix}\n Remote Oracle Cloud Object Storage accessed via presigned URLs (browser runtime).\n Supports the full filesystem command set: ls/tree/cat/grep/find/du/cp/mv/rm/etc.\n Listing operations require the presigner to sign LI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AACpC,WAAO;AAAA,EACT,CAAC;AACH;AAEO,IAAM,cAAN,cAA0B,WAAW;AAAA,EACxB,OAAe,aAAa;AAAA,EAC5B,SAAiB;AAAA,EAC1B;AAAA,EACQ;AAAA,EACA;AAAA,EAEjB,YAAY,QAAmB;AAC7B,UAAM,cAAc,MAAM,CAAC;AAC3B,SAAK,YAAY;AACjB,SAAK,SAAS,iBAAiB,MAAM,IAAI,GAAG,aAAa,GAAG;AAC5D,SAAK,cAAc,sBAAsB,MAAM,SAAS,GAAG,aAAa,GAAG;AAAA,EAC7E;AAAA,EAES,MAA+B;AACtC,WAAO,KAAK;AAAA,EACd;AAAA,EAES,WAAyC;AAChD,WAAO,KAAK;AAAA,EACd;AAAA,EAES,WAAsC;AAC7C,WAAO,QAAQ,QAAQ;AAAA,MACrB,MAAM,KAAK;AAAA,MACX,eAAe;AAAA,MACf,gBAAgB,CAAC,sBAAsB;AAAA,MACvC,QAAQ,gBAAgB,KAAK,SAAS;AAAA,IACxC,CAAC;AAAA,EACH;AAAA,EAES,UAAU,QAAyC;AAC1D,WAAO,QAAQ,QAAQ;AAAA,EACzB;AACF;","names":[]}
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
// src/resource/dropbox/config.ts
|
|
2
|
+
import { normalizeFields } from "@struktoai/mirage-core";
|
|
3
|
+
function redactDropboxConfig(config) {
|
|
4
|
+
return {
|
|
5
|
+
clientId: config.clientId,
|
|
6
|
+
...config.clientSecret !== void 0 ? { clientSecret: "<REDACTED>" } : {},
|
|
7
|
+
refreshToken: "<REDACTED>"
|
|
8
|
+
};
|
|
9
|
+
}
|
|
10
|
+
function normalizeDropboxConfig(input) {
|
|
11
|
+
return normalizeFields(input, {
|
|
12
|
+
rename: {
|
|
13
|
+
client_id: "clientId",
|
|
14
|
+
client_secret: "clientSecret",
|
|
15
|
+
refresh_token: "refreshToken"
|
|
16
|
+
}
|
|
17
|
+
});
|
|
18
|
+
}
|
|
19
|
+
|
|
20
|
+
export {
|
|
21
|
+
redactDropboxConfig,
|
|
22
|
+
normalizeDropboxConfig
|
|
23
|
+
};
|
|
24
|
+
//# sourceMappingURL=chunk-7GZXXXAS.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../src/resource/dropbox/config.ts"],"sourcesContent":["// ========= Copyright 2026 @ Strukto.AI All Rights Reserved. =========\n// Licensed under the Apache License, Version 2.0 (the \"License\");\n// you may not use this file except in compliance with the License.\n// You may obtain a copy of the License at\n//\n// http://www.apache.org/licenses/LICENSE-2.0\n//\n// Unless required by applicable law or agreed to in writing, software\n// distributed under the License is distributed on an \"AS IS\" BASIS,\n// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n// See the License for the specific language governing permissions and\n// limitations under the License.\n// ========= Copyright 2026 @ Strukto.AI All Rights Reserved. =========\n\nimport { normalizeFields } from '@struktoai/mirage-core'\n\nexport interface DropboxConfig {\n clientId: string\n clientSecret?: string\n refreshToken: string\n refreshFn?: (refreshToken: string) => Promise<{ accessToken: string; expiresIn: number }>\n}\n\nexport interface DropboxConfigRedacted {\n clientId: string\n clientSecret?: '<REDACTED>'\n refreshToken: '<REDACTED>'\n}\n\nexport function redactDropboxConfig(config: DropboxConfig): DropboxConfigRedacted {\n return {\n clientId: config.clientId,\n ...(config.clientSecret !== undefined ? { clientSecret: '<REDACTED>' as const } : {}),\n refreshToken: '<REDACTED>',\n }\n}\n\nexport function normalizeDropboxConfig(input: Record<string, unknown>): DropboxConfig {\n return normalizeFields(input, {\n rename: {\n client_id: 'clientId',\n client_secret: 'clientSecret',\n refresh_token: 'refreshToken',\n },\n }) as unknown as DropboxConfig\n}\n"],"mappings":";AAcA,SAAS,uBAAuB;AAezB,SAAS,oBAAoB,QAA8C;AAChF,SAAO;AAAA,IACL,UAAU,OAAO;AAAA,IACjB,GAAI,OAAO,iBAAiB,SAAY,EAAE,cAAc,aAAsB,IAAI,CAAC;AAAA,IACnF,cAAc;AAAA,EAChB;AACF;AAEO,SAAS,uBAAuB,OAA+C;AACpF,SAAO,gBAAgB,OAAO;AAAA,IAC5B,QAAQ;AAAA,MACN,WAAW;AAAA,MACX,eAAe;AAAA,MACf,eAAe;AAAA,IACjB;AAAA,EACF,CAAC;AACH;","names":[]}
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
// src/resource/gslides/config.ts
|
|
2
|
+
import { normalizeFields } from "@struktoai/mirage-core";
|
|
3
|
+
function redactGSlidesConfig(config) {
|
|
4
|
+
return {
|
|
5
|
+
clientId: config.clientId,
|
|
6
|
+
...config.clientSecret !== void 0 ? { clientSecret: "<REDACTED>" } : {},
|
|
7
|
+
refreshToken: "<REDACTED>"
|
|
8
|
+
};
|
|
9
|
+
}
|
|
10
|
+
function normalizeGSlidesConfig(input) {
|
|
11
|
+
return normalizeFields(input, {
|
|
12
|
+
rename: {
|
|
13
|
+
client_id: "clientId",
|
|
14
|
+
client_secret: "clientSecret",
|
|
15
|
+
refresh_token: "refreshToken"
|
|
16
|
+
}
|
|
17
|
+
});
|
|
18
|
+
}
|
|
19
|
+
|
|
20
|
+
export {
|
|
21
|
+
redactGSlidesConfig,
|
|
22
|
+
normalizeGSlidesConfig
|
|
23
|
+
};
|
|
24
|
+
//# sourceMappingURL=chunk-B4SYG2FD.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../src/resource/gslides/config.ts"],"sourcesContent":["// ========= Copyright 2026 @ Strukto.AI All Rights Reserved. =========\n// Licensed under the Apache License, Version 2.0 (the \"License\");\n// you may not use this file except in compliance with the License.\n// You may obtain a copy of the License at\n//\n// http://www.apache.org/licenses/LICENSE-2.0\n//\n// Unless required by applicable law or agreed to in writing, software\n// distributed under the License is distributed on an \"AS IS\" BASIS,\n// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n// See the License for the specific language governing permissions and\n// limitations under the License.\n// ========= Copyright 2026 @ Strukto.AI All Rights Reserved. =========\n\nimport { normalizeFields } from '@struktoai/mirage-core'\n\nexport interface GSlidesConfig {\n clientId: string\n clientSecret?: string\n refreshToken: string\n refreshFn?: (refreshToken: string) => Promise<{ accessToken: string; expiresIn: number }>\n}\n\nexport interface GSlidesConfigRedacted {\n clientId: string\n clientSecret?: '<REDACTED>'\n refreshToken: '<REDACTED>'\n}\n\nexport function redactGSlidesConfig(config: GSlidesConfig): GSlidesConfigRedacted {\n return {\n clientId: config.clientId,\n ...(config.clientSecret !== undefined ? { clientSecret: '<REDACTED>' as const } : {}),\n refreshToken: '<REDACTED>',\n }\n}\n\nexport function normalizeGSlidesConfig(input: Record<string, unknown>): GSlidesConfig {\n return normalizeFields(input, {\n rename: {\n client_id: 'clientId',\n client_secret: 'clientSecret',\n refresh_token: 'refreshToken',\n },\n }) as unknown as GSlidesConfig\n}\n"],"mappings":";AAcA,SAAS,uBAAuB;AAezB,SAAS,oBAAoB,QAA8C;AAChF,SAAO;AAAA,IACL,UAAU,OAAO;AAAA,IACjB,GAAI,OAAO,iBAAiB,SAAY,EAAE,cAAc,aAAsB,IAAI,CAAC;AAAA,IACnF,cAAc;AAAA,EAChB;AACF;AAEO,SAAS,uBAAuB,OAA+C;AACpF,SAAO,gBAAgB,OAAO;AAAA,IAC5B,QAAQ;AAAA,MACN,WAAW;AAAA,MACX,eAAe;AAAA,MACf,eAAe;AAAA,IACjB;AAAA,EACF,CAAC;AACH;","names":[]}
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
// src/resource/gsheets/config.ts
|
|
2
|
+
import { normalizeFields } from "@struktoai/mirage-core";
|
|
3
|
+
function redactGSheetsConfig(config) {
|
|
4
|
+
return {
|
|
5
|
+
clientId: config.clientId,
|
|
6
|
+
...config.clientSecret !== void 0 ? { clientSecret: "<REDACTED>" } : {},
|
|
7
|
+
refreshToken: "<REDACTED>"
|
|
8
|
+
};
|
|
9
|
+
}
|
|
10
|
+
function normalizeGSheetsConfig(input) {
|
|
11
|
+
return normalizeFields(input, {
|
|
12
|
+
rename: {
|
|
13
|
+
client_id: "clientId",
|
|
14
|
+
client_secret: "clientSecret",
|
|
15
|
+
refresh_token: "refreshToken"
|
|
16
|
+
}
|
|
17
|
+
});
|
|
18
|
+
}
|
|
19
|
+
|
|
20
|
+
export {
|
|
21
|
+
redactGSheetsConfig,
|
|
22
|
+
normalizeGSheetsConfig
|
|
23
|
+
};
|
|
24
|
+
//# sourceMappingURL=chunk-BIZONEJC.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../src/resource/gsheets/config.ts"],"sourcesContent":["// ========= Copyright 2026 @ Strukto.AI All Rights Reserved. =========\n// Licensed under the Apache License, Version 2.0 (the \"License\");\n// you may not use this file except in compliance with the License.\n// You may obtain a copy of the License at\n//\n// http://www.apache.org/licenses/LICENSE-2.0\n//\n// Unless required by applicable law or agreed to in writing, software\n// distributed under the License is distributed on an \"AS IS\" BASIS,\n// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n// See the License for the specific language governing permissions and\n// limitations under the License.\n// ========= Copyright 2026 @ Strukto.AI All Rights Reserved. =========\n\nimport { normalizeFields } from '@struktoai/mirage-core'\n\nexport interface GSheetsConfig {\n clientId: string\n clientSecret?: string\n refreshToken: string\n refreshFn?: (refreshToken: string) => Promise<{ accessToken: string; expiresIn: number }>\n}\n\nexport interface GSheetsConfigRedacted {\n clientId: string\n clientSecret?: '<REDACTED>'\n refreshToken: '<REDACTED>'\n}\n\nexport function redactGSheetsConfig(config: GSheetsConfig): GSheetsConfigRedacted {\n return {\n clientId: config.clientId,\n ...(config.clientSecret !== undefined ? { clientSecret: '<REDACTED>' as const } : {}),\n refreshToken: '<REDACTED>',\n }\n}\n\nexport function normalizeGSheetsConfig(input: Record<string, unknown>): GSheetsConfig {\n return normalizeFields(input, {\n rename: {\n client_id: 'clientId',\n client_secret: 'clientSecret',\n refresh_token: 'refreshToken',\n },\n }) as unknown as GSheetsConfig\n}\n"],"mappings":";AAcA,SAAS,uBAAuB;AAezB,SAAS,oBAAoB,QAA8C;AAChF,SAAO;AAAA,IACL,UAAU,OAAO;AAAA,IACjB,GAAI,OAAO,iBAAiB,SAAY,EAAE,cAAc,aAAsB,IAAI,CAAC;AAAA,IACnF,cAAc;AAAA,EAChB;AACF;AAEO,SAAS,uBAAuB,OAA+C;AACpF,SAAO,gBAAgB,OAAO;AAAA,IAC5B,QAAQ;AAAA,MACN,WAAW;AAAA,MACX,eAAe;AAAA,MACf,eAAe;AAAA,IACjB;AAAA,EACF,CAAC;AACH;","names":[]}
|
|
@@ -0,0 +1,92 @@
|
|
|
1
|
+
import {
|
|
2
|
+
redactDropboxConfig
|
|
3
|
+
} from "./chunk-7GZXXXAS.js";
|
|
4
|
+
|
|
5
|
+
// src/resource/dropbox/dropbox.ts
|
|
6
|
+
import {
|
|
7
|
+
DROPBOX_COMMANDS,
|
|
8
|
+
DROPBOX_PROMPT,
|
|
9
|
+
DROPBOX_VFS_OPS,
|
|
10
|
+
DropboxAccessor,
|
|
11
|
+
DropboxTokenManager,
|
|
12
|
+
PathSpec,
|
|
13
|
+
RAMIndexCacheStore,
|
|
14
|
+
ResourceName,
|
|
15
|
+
dropboxRead,
|
|
16
|
+
dropboxReaddir,
|
|
17
|
+
dropboxResolveGlob,
|
|
18
|
+
dropboxStat
|
|
19
|
+
} from "@struktoai/mirage-core";
|
|
20
|
+
var DropboxResource = class {
|
|
21
|
+
kind = ResourceName.DROPBOX;
|
|
22
|
+
isRemote = true;
|
|
23
|
+
indexTtl = 86400;
|
|
24
|
+
prompt = DROPBOX_PROMPT;
|
|
25
|
+
config;
|
|
26
|
+
accessor;
|
|
27
|
+
index;
|
|
28
|
+
constructor(config) {
|
|
29
|
+
this.config = config;
|
|
30
|
+
const tm = new DropboxTokenManager({
|
|
31
|
+
clientId: config.clientId,
|
|
32
|
+
...config.clientSecret !== void 0 ? { clientSecret: config.clientSecret } : {},
|
|
33
|
+
refreshToken: config.refreshToken,
|
|
34
|
+
...config.refreshFn !== void 0 ? { refreshFn: config.refreshFn } : {}
|
|
35
|
+
});
|
|
36
|
+
this.accessor = new DropboxAccessor({ tokenManager: tm });
|
|
37
|
+
this.index = new RAMIndexCacheStore({ ttl: 86400 });
|
|
38
|
+
}
|
|
39
|
+
open() {
|
|
40
|
+
return Promise.resolve();
|
|
41
|
+
}
|
|
42
|
+
close() {
|
|
43
|
+
return Promise.resolve();
|
|
44
|
+
}
|
|
45
|
+
commands() {
|
|
46
|
+
return DROPBOX_COMMANDS;
|
|
47
|
+
}
|
|
48
|
+
ops() {
|
|
49
|
+
return DROPBOX_VFS_OPS;
|
|
50
|
+
}
|
|
51
|
+
readFile(p) {
|
|
52
|
+
return dropboxRead(this.accessor, p, this.index);
|
|
53
|
+
}
|
|
54
|
+
readdir(p) {
|
|
55
|
+
return dropboxReaddir(this.accessor, p, this.index);
|
|
56
|
+
}
|
|
57
|
+
stat(p) {
|
|
58
|
+
return dropboxStat(this.accessor, p, this.index);
|
|
59
|
+
}
|
|
60
|
+
async fingerprint(p) {
|
|
61
|
+
const lookup = await this.index.get(p.original);
|
|
62
|
+
return lookup.entry?.remoteTime ?? null;
|
|
63
|
+
}
|
|
64
|
+
glob(paths, prefix = "") {
|
|
65
|
+
const effective = prefix !== "" ? paths.map(
|
|
66
|
+
(p) => p.prefix !== "" ? p : new PathSpec({
|
|
67
|
+
original: p.original,
|
|
68
|
+
directory: p.directory,
|
|
69
|
+
...p.pattern !== null ? { pattern: p.pattern } : {},
|
|
70
|
+
resolved: p.resolved,
|
|
71
|
+
prefix
|
|
72
|
+
})
|
|
73
|
+
) : paths;
|
|
74
|
+
return dropboxResolveGlob(this.accessor, effective, this.index);
|
|
75
|
+
}
|
|
76
|
+
getState() {
|
|
77
|
+
return Promise.resolve({
|
|
78
|
+
type: this.kind,
|
|
79
|
+
needsOverride: true,
|
|
80
|
+
redactedFields: ["clientSecret", "refreshToken"],
|
|
81
|
+
config: redactDropboxConfig(this.config)
|
|
82
|
+
});
|
|
83
|
+
}
|
|
84
|
+
loadState(_state) {
|
|
85
|
+
return Promise.resolve();
|
|
86
|
+
}
|
|
87
|
+
};
|
|
88
|
+
|
|
89
|
+
export {
|
|
90
|
+
DropboxResource
|
|
91
|
+
};
|
|
92
|
+
//# sourceMappingURL=chunk-CQJTW45B.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../src/resource/dropbox/dropbox.ts"],"sourcesContent":["// ========= Copyright 2026 @ Strukto.AI All Rights Reserved. =========\n// Licensed under the Apache License, Version 2.0 (the \"License\");\n// you may not use this file except in compliance with the License.\n// You may obtain a copy of the License at\n//\n// http://www.apache.org/licenses/LICENSE-2.0\n//\n// Unless required by applicable law or agreed to in writing, software\n// distributed under the License is distributed on an \"AS IS\" BASIS,\n// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n// See the License for the specific language governing permissions and\n// limitations under the License.\n// ========= Copyright 2026 @ Strukto.AI All Rights Reserved. =========\n\nimport {\n type FileStat,\n DROPBOX_COMMANDS,\n DROPBOX_PROMPT,\n DROPBOX_VFS_OPS,\n DropboxAccessor,\n DropboxTokenManager,\n type IndexCacheStore,\n PathSpec,\n RAMIndexCacheStore,\n type RegisteredCommand,\n type RegisteredOp,\n type Resource,\n ResourceName,\n dropboxRead,\n dropboxReaddir,\n dropboxResolveGlob,\n dropboxStat,\n} from '@struktoai/mirage-core'\nimport { redactDropboxConfig, type DropboxConfig, type DropboxConfigRedacted } from './config.ts'\n\nexport interface DropboxResourceState {\n type: string\n needsOverride: boolean\n redactedFields: readonly string[]\n config: DropboxConfigRedacted\n}\n\nexport class DropboxResource implements Resource {\n readonly kind: string = ResourceName.DROPBOX\n readonly isRemote: boolean = true\n readonly indexTtl: number = 86_400\n readonly prompt: string = DROPBOX_PROMPT\n readonly config: DropboxConfig\n readonly accessor: DropboxAccessor\n readonly index: IndexCacheStore\n\n constructor(config: DropboxConfig) {\n this.config = config\n const tm = new DropboxTokenManager({\n clientId: config.clientId,\n ...(config.clientSecret !== undefined ? { clientSecret: config.clientSecret } : {}),\n refreshToken: config.refreshToken,\n ...(config.refreshFn !== undefined ? { refreshFn: config.refreshFn } : {}),\n })\n this.accessor = new DropboxAccessor({ tokenManager: tm })\n this.index = new RAMIndexCacheStore({ ttl: 86_400 })\n }\n\n open(): Promise<void> {\n return Promise.resolve()\n }\n\n close(): Promise<void> {\n return Promise.resolve()\n }\n\n commands(): readonly RegisteredCommand[] {\n return DROPBOX_COMMANDS\n }\n\n ops(): readonly RegisteredOp[] {\n return DROPBOX_VFS_OPS\n }\n\n readFile(p: PathSpec): Promise<Uint8Array> {\n return dropboxRead(this.accessor, p, this.index)\n }\n\n readdir(p: PathSpec): Promise<string[]> {\n return dropboxReaddir(this.accessor, p, this.index)\n }\n\n stat(p: PathSpec): Promise<FileStat> {\n return dropboxStat(this.accessor, p, this.index)\n }\n\n async fingerprint(p: PathSpec): Promise<string | null> {\n const lookup = await this.index.get(p.original)\n return lookup.entry?.remoteTime ?? null\n }\n\n glob(paths: readonly PathSpec[], prefix = ''): Promise<PathSpec[]> {\n const effective =\n prefix !== ''\n ? paths.map((p) =>\n p.prefix !== ''\n ? p\n : new PathSpec({\n original: p.original,\n directory: p.directory,\n ...(p.pattern !== null ? { pattern: p.pattern } : {}),\n resolved: p.resolved,\n prefix,\n }),\n )\n : paths\n return dropboxResolveGlob(this.accessor, effective, this.index)\n }\n\n getState(): Promise<DropboxResourceState> {\n return Promise.resolve({\n type: this.kind,\n needsOverride: true,\n redactedFields: ['clientSecret', 'refreshToken'],\n config: redactDropboxConfig(this.config),\n })\n }\n\n loadState(_state: DropboxResourceState): Promise<void> {\n return Promise.resolve()\n }\n}\n"],"mappings":";;;;;AAcA;AAAA,EAEE;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EAEA;AAAA,EACA;AAAA,EAIA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,OACK;AAUA,IAAM,kBAAN,MAA0C;AAAA,EACtC,OAAe,aAAa;AAAA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AU,EAAE;AAAA,QACZ,WAAW,EAAE;AAAA,QACb,GAAI,EAAE,YAAY,OAAO,EAAE,SAAS,EAAE,QAAQ,IAAI,CAAC;AAAA,QACnD,UAAU,EAAE;AAAA,QACZ;AAAA,MACF,CAAC;AAAA,IACP,IACA;AACN,WAAO,mBAAmB,KAAK,UAAU,WAAW,KAAK,KAAK;AAAA,EAChE;AAAA,EAEA,WAA0C;AACxC,WAAO,QAAQ,QAAQ;AAAA,MACrB,MAAM,KAAK;AAAA,MACX,eAAe;AAAA,MACf,gBAAgB,CAAC,gBAAgB,cAAc;AAAA,MAC/C,QAAQ,oBAAoB,KAAK,MAAM;AAAA,IACzC,CAAC;AAAA,EACH;AAAA,EAEA,UAAU,QAA6C;AACrD,WAAO,QAAQ,QAAQ;AAAA,EACzB;AACF;","names":[]}
|
|
@@ -0,0 +1,93 @@
|
|
|
1
|
+
import {
|
|
2
|
+
redactGitHubCIConfig
|
|
3
|
+
} from "./chunk-QARIHW3I.js";
|
|
4
|
+
|
|
5
|
+
// src/resource/github_ci/github_ci.ts
|
|
6
|
+
import {
|
|
7
|
+
GITHUB_CI_COMMANDS,
|
|
8
|
+
GITHUB_CI_PROMPT,
|
|
9
|
+
GITHUB_CI_VFS_OPS,
|
|
10
|
+
GitHubCIAccessor,
|
|
11
|
+
HttpCITransport,
|
|
12
|
+
PathSpec,
|
|
13
|
+
RAMIndexCacheStore,
|
|
14
|
+
ResourceName,
|
|
15
|
+
githubCiRead,
|
|
16
|
+
githubCiReaddir,
|
|
17
|
+
githubCiResolveGlob,
|
|
18
|
+
githubCiStat
|
|
19
|
+
} from "@struktoai/mirage-core";
|
|
20
|
+
var GitHubCIResource = class {
|
|
21
|
+
kind = ResourceName.GITHUB_CI;
|
|
22
|
+
isRemote = true;
|
|
23
|
+
indexTtl = 86400;
|
|
24
|
+
prompt = GITHUB_CI_PROMPT;
|
|
25
|
+
config;
|
|
26
|
+
accessor;
|
|
27
|
+
index;
|
|
28
|
+
constructor(config) {
|
|
29
|
+
this.config = config;
|
|
30
|
+
const transportOpts = { token: config.token };
|
|
31
|
+
if (config.baseUrl !== void 0) transportOpts.baseUrl = config.baseUrl;
|
|
32
|
+
this.accessor = new GitHubCIAccessor({
|
|
33
|
+
transport: new HttpCITransport(transportOpts),
|
|
34
|
+
owner: config.owner,
|
|
35
|
+
repo: config.repo,
|
|
36
|
+
days: config.days ?? 30
|
|
37
|
+
});
|
|
38
|
+
this.index = new RAMIndexCacheStore({ ttl: 86400 });
|
|
39
|
+
}
|
|
40
|
+
open() {
|
|
41
|
+
return Promise.resolve();
|
|
42
|
+
}
|
|
43
|
+
close() {
|
|
44
|
+
return Promise.resolve();
|
|
45
|
+
}
|
|
46
|
+
commands() {
|
|
47
|
+
return GITHUB_CI_COMMANDS;
|
|
48
|
+
}
|
|
49
|
+
ops() {
|
|
50
|
+
return GITHUB_CI_VFS_OPS;
|
|
51
|
+
}
|
|
52
|
+
readFile(p) {
|
|
53
|
+
return githubCiRead(this.accessor, p, this.index);
|
|
54
|
+
}
|
|
55
|
+
readdir(p) {
|
|
56
|
+
return githubCiReaddir(this.accessor, p, this.index);
|
|
57
|
+
}
|
|
58
|
+
stat(p) {
|
|
59
|
+
return githubCiStat(this.accessor, p, this.index);
|
|
60
|
+
}
|
|
61
|
+
async fingerprint(p) {
|
|
62
|
+
const lookup = await this.index.get(p.original);
|
|
63
|
+
return lookup.entry?.remoteTime ?? null;
|
|
64
|
+
}
|
|
65
|
+
glob(paths, prefix = "") {
|
|
66
|
+
const effective = prefix !== "" ? paths.map(
|
|
67
|
+
(p) => p.prefix !== "" ? p : new PathSpec({
|
|
68
|
+
original: p.original,
|
|
69
|
+
directory: p.directory,
|
|
70
|
+
...p.pattern !== null ? { pattern: p.pattern } : {},
|
|
71
|
+
resolved: p.resolved,
|
|
72
|
+
prefix
|
|
73
|
+
})
|
|
74
|
+
) : paths;
|
|
75
|
+
return githubCiResolveGlob(this.accessor, effective, this.index);
|
|
76
|
+
}
|
|
77
|
+
getState() {
|
|
78
|
+
return Promise.resolve({
|
|
79
|
+
type: this.kind,
|
|
80
|
+
needsOverride: true,
|
|
81
|
+
redactedFields: ["token"],
|
|
82
|
+
config: redactGitHubCIConfig(this.config)
|
|
83
|
+
});
|
|
84
|
+
}
|
|
85
|
+
loadState(_state) {
|
|
86
|
+
return Promise.resolve();
|
|
87
|
+
}
|
|
88
|
+
};
|
|
89
|
+
|
|
90
|
+
export {
|
|
91
|
+
GitHubCIResource
|
|
92
|
+
};
|
|
93
|
+
//# sourceMappingURL=chunk-CZOTICOC.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../src/resource/github_ci/github_ci.ts"],"sourcesContent":["// ========= Copyright 2026 @ Strukto.AI All Rights Reserved. =========\n// Licensed under the Apache License, Version 2.0 (the \"License\");\n// you may not use this file except in compliance with the License.\n// You may obtain a copy of the License at\n//\n// http://www.apache.org/licenses/LICENSE-2.0\n//\n// Unless required by applicable law or agreed to in writing, software\n// distributed under the License is distributed on an \"AS IS\" BASIS,\n// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n// See the License for the specific language governing permissions and\n// limitations under the License.\n// ========= Copyright 2026 @ Strukto.AI All Rights Reserved. =========\n\nimport {\n type FileStat,\n GITHUB_CI_COMMANDS,\n GITHUB_CI_PROMPT,\n GITHUB_CI_VFS_OPS,\n GitHubCIAccessor,\n HttpCITransport,\n type IndexCacheStore,\n PathSpec,\n RAMIndexCacheStore,\n type RegisteredCommand,\n type RegisteredOp,\n type Resource,\n ResourceName,\n githubCiRead,\n githubCiReaddir,\n githubCiResolveGlob,\n githubCiStat,\n} from '@struktoai/mirage-core'\nimport { redactGitHubCIConfig, type GitHubCIConfig, type GitHubCIConfigRedacted } from './config.ts'\n\nexport interface GitHubCIResourceState {\n type: string\n needsOverride: boolean\n redactedFields: readonly string[]\n config: GitHubCIConfigRedacted\n}\n\nexport class GitHubCIResource implements Resource {\n readonly kind: string = ResourceName.GITHUB_CI\n readonly isRemote: boolean = true\n readonly indexTtl: number = 86_400\n readonly prompt: string = GITHUB_CI_PROMPT\n readonly config: GitHubCIConfig\n readonly accessor: GitHubCIAccessor\n readonly index: IndexCacheStore\n\n constructor(config: GitHubCIConfig) {\n this.config = config\n const transportOpts: { token: string; baseUrl?: string } = { token: config.token }\n if (config.baseUrl !== undefined) transportOpts.baseUrl = config.baseUrl\n this.accessor = new GitHubCIAccessor({\n transport: new HttpCITransport(transportOpts),\n owner: config.owner,\n repo: config.repo,\n days: config.days ?? 30,\n })\n this.index = new RAMIndexCacheStore({ ttl: 86_400 })\n }\n\n open(): Promise<void> {\n return Promise.resolve()\n }\n\n close(): Promise<void> {\n return Promise.resolve()\n }\n\n commands(): readonly RegisteredCommand[] {\n return GITHUB_CI_COMMANDS\n }\n\n ops(): readonly RegisteredOp[] {\n return GITHUB_CI_VFS_OPS\n }\n\n readFile(p: PathSpec): Promise<Uint8Array> {\n return githubCiRead(this.accessor, p, this.index)\n }\n\n readdir(p: PathSpec): Promise<string[]> {\n return githubCiReaddir(this.accessor, p, this.index)\n }\n\n stat(p: PathSpec): Promise<FileStat> {\n return githubCiStat(this.accessor, p, this.index)\n }\n\n async fingerprint(p: PathSpec): Promise<string | null> {\n const lookup = await this.index.get(p.original)\n return lookup.entry?.remoteTime ?? null\n }\n\n glob(paths: readonly PathSpec[], prefix = ''): Promise<PathSpec[]> {\n const effective =\n prefix !== ''\n ? paths.map((p) =>\n p.prefix !== ''\n ? p\n : new PathSpec({\n original: p.original,\n directory: p.directory,\n ...(p.pattern !== null ? { pattern: p.pattern } : {}),\n resolved: p.resolved,\n prefix,\n }),\n )\n : paths\n return githubCiResolveGlob(this.accessor, effective, this.index)\n }\n\n getState(): Promise<GitHubCIResourceState> {\n return Promise.resolve({\n type: this.kind,\n needsOverride: true,\n redactedFields: ['token'],\n config: redactGitHubCIConfig(this.config),\n })\n }\n\n loadState(_state: GitHubCIResourceState): Promise<void> {\n return Promise.resolve()\n }\n}\n"],"mapp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OAAO,OAAO,cAAc;AAAA,EACrC;AAAA,EAEA,KAAK,OAA4B,SAAS,IAAyB;AACjE,UAAM,YACJ,WAAW,KACP,MAAM;AAAA,MAAI,CAAC,MACT,EAAE,WAAW,KACT,IACA,IAAI,SAAS;AAAA,QACX,UAAU,EAAE;AAAA,QACZ,WAAW,EAAE;AAAA,QACb,GAAI,EAAE,YAAY,OAAO,EAAE,SAAS,EAAE,QAAQ,IAAI,CAAC;AAAA,QACnD,UAAU,EAAE;AAAA,QACZ;AAAA,MACF,CAAC;AAAA,IACP,IACA;AACN,WAAO,oBAAoB,KAAK,UAAU,WAAW,KAAK,KAAK;AAAA,EACjE;AAAA,EAEA,WAA2C;AACzC,WAAO,QAAQ,QAAQ;AAAA,MACrB,MAAM,KAAK;AAAA,MACX,eAAe;AAAA,MACf,gBAAgB,CAAC,OAAO;AAAA,MACxB,QAAQ,qBAAqB,KAAK,MAAM;AAAA,IAC1C,CAAC;AAAA,EACH;AAAA,EAEA,UAAU,QAA8C;AACtD,WAAO,QAAQ,QAAQ;AAAA,EACzB;AACF;","names":[]}
|
|
@@ -0,0 +1,94 @@
|
|
|
1
|
+
import {
|
|
2
|
+
redactBoxConfig
|
|
3
|
+
} from "./chunk-NBWTZXH2.js";
|
|
4
|
+
|
|
5
|
+
// src/resource/box/box.ts
|
|
6
|
+
import {
|
|
7
|
+
BOX_COMMANDS,
|
|
8
|
+
BOX_PROMPT,
|
|
9
|
+
BOX_VFS_OPS,
|
|
10
|
+
BoxAccessor,
|
|
11
|
+
BoxTokenManager,
|
|
12
|
+
PathSpec,
|
|
13
|
+
RAMIndexCacheStore,
|
|
14
|
+
ResourceName,
|
|
15
|
+
boxRead,
|
|
16
|
+
boxReaddir,
|
|
17
|
+
boxResolveGlob,
|
|
18
|
+
boxStat
|
|
19
|
+
} from "@struktoai/mirage-core";
|
|
20
|
+
var BoxResource = class {
|
|
21
|
+
kind = ResourceName.BOX;
|
|
22
|
+
isRemote = true;
|
|
23
|
+
indexTtl = 86400;
|
|
24
|
+
prompt = BOX_PROMPT;
|
|
25
|
+
config;
|
|
26
|
+
accessor;
|
|
27
|
+
index;
|
|
28
|
+
constructor(config) {
|
|
29
|
+
this.config = config;
|
|
30
|
+
const tm = new BoxTokenManager({
|
|
31
|
+
...config.clientId !== void 0 ? { clientId: config.clientId } : {},
|
|
32
|
+
...config.clientSecret !== void 0 ? { clientSecret: config.clientSecret } : {},
|
|
33
|
+
...config.refreshToken !== void 0 ? { refreshToken: config.refreshToken } : {},
|
|
34
|
+
...config.accessToken !== void 0 ? { accessToken: config.accessToken } : {},
|
|
35
|
+
...config.refreshFn !== void 0 ? { refreshFn: config.refreshFn } : {},
|
|
36
|
+
...config.onRefreshTokenRotated !== void 0 ? { onRefreshTokenRotated: config.onRefreshTokenRotated } : {}
|
|
37
|
+
});
|
|
38
|
+
this.accessor = new BoxAccessor({ tokenManager: tm });
|
|
39
|
+
this.index = new RAMIndexCacheStore({ ttl: 86400 });
|
|
40
|
+
}
|
|
41
|
+
open() {
|
|
42
|
+
return Promise.resolve();
|
|
43
|
+
}
|
|
44
|
+
close() {
|
|
45
|
+
return Promise.resolve();
|
|
46
|
+
}
|
|
47
|
+
commands() {
|
|
48
|
+
return BOX_COMMANDS;
|
|
49
|
+
}
|
|
50
|
+
ops() {
|
|
51
|
+
return BOX_VFS_OPS;
|
|
52
|
+
}
|
|
53
|
+
readFile(p) {
|
|
54
|
+
return boxRead(this.accessor, p, this.index);
|
|
55
|
+
}
|
|
56
|
+
readdir(p) {
|
|
57
|
+
return boxReaddir(this.accessor, p, this.index);
|
|
58
|
+
}
|
|
59
|
+
stat(p) {
|
|
60
|
+
return boxStat(this.accessor, p, this.index);
|
|
61
|
+
}
|
|
62
|
+
async fingerprint(p) {
|
|
63
|
+
const lookup = await this.index.get(p.original);
|
|
64
|
+
return lookup.entry?.remoteTime ?? null;
|
|
65
|
+
}
|
|
66
|
+
glob(paths, prefix = "") {
|
|
67
|
+
const effective = prefix !== "" ? paths.map(
|
|
68
|
+
(p) => p.prefix !== "" ? p : new PathSpec({
|
|
69
|
+
original: p.original,
|
|
70
|
+
directory: p.directory,
|
|
71
|
+
...p.pattern !== null ? { pattern: p.pattern } : {},
|
|
72
|
+
resolved: p.resolved,
|
|
73
|
+
prefix
|
|
74
|
+
})
|
|
75
|
+
) : paths;
|
|
76
|
+
return boxResolveGlob(this.accessor, effective, this.index);
|
|
77
|
+
}
|
|
78
|
+
getState() {
|
|
79
|
+
return Promise.resolve({
|
|
80
|
+
type: this.kind,
|
|
81
|
+
needsOverride: true,
|
|
82
|
+
redactedFields: ["clientSecret", "refreshToken", "accessToken"],
|
|
83
|
+
config: redactBoxConfig(this.config)
|
|
84
|
+
});
|
|
85
|
+
}
|
|
86
|
+
loadState(_state) {
|
|
87
|
+
return Promise.resolve();
|
|
88
|
+
}
|
|
89
|
+
};
|
|
90
|
+
|
|
91
|
+
export {
|
|
92
|
+
BoxResource
|
|
93
|
+
};
|
|
94
|
+
//# sourceMappingURL=chunk-DDM2Z7YA.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../src/resource/box/box.ts"],"sourcesContent":["// ========= Copyright 2026 @ Strukto.AI All Rights Reserved. =========\n// Licensed under the Apache License, Version 2.0 (the \"License\");\n// you may not use this file except in compliance with the License.\n// You may obtain a copy of the License at\n//\n// http://www.apache.org/licenses/LICENSE-2.0\n//\n// Unless required by applicable law or agreed to in writing, software\n// distributed under the License is distributed on an \"AS IS\" BASIS,\n// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n// See the License for the specific language governing permissions and\n// limitations under the License.\n// ========= Copyright 2026 @ Strukto.AI All Rights Reserved. =========\n\nimport {\n BOX_COMMANDS,\n BOX_PROMPT,\n BOX_VFS_OPS,\n BoxAccessor,\n BoxTokenManager,\n type FileStat,\n type IndexCacheStore,\n PathSpec,\n RAMIndexCacheStore,\n type RegisteredCommand,\n type RegisteredOp,\n type Resource,\n ResourceName,\n boxRead,\n boxReaddir,\n boxResolveGlob,\n boxStat,\n} from '@struktoai/mirage-core'\nimport { redactBoxConfig, type BoxConfig, type BoxConfigRedacted } from './config.ts'\n\nexport interface BoxResourceState {\n type: string\n needsOverride: boolean\n redactedFields: readonly string[]\n config: BoxConfigRedacted\n}\n\nexport class BoxResource implements Resource {\n readonly kind: string = ResourceName.BOX\n readonly isRemote: boolean = true\n readonly indexTtl: number = 86_400\n readonly prompt: string = BOX_PROMPT\n readonly config: BoxConfig\n readonly accessor: BoxAccessor\n readonly index: IndexCacheStore\n\n constructor(config: BoxConfig) {\n this.config = config\n const tm = new BoxTokenManager({\n ...(config.clientId !== undefined ? { clientId: config.clientId } : {}),\n ...(config.clientSecret !== undefined ? { clientSecret: config.clientSecret } : {}),\n ...(config.refreshToken !== undefined ? { refreshToken: config.refreshToken } : {}),\n ...(config.accessToken !== undefined ? { accessToken: config.accessToken } : {}),\n ...(config.refreshFn !== undefined ? { refreshFn: config.refreshFn } : {}),\n ...(config.onRefreshTokenRotated !== undefined\n ? { onRefreshTokenRotated: config.onRefreshTokenRotated }\n : {}),\n })\n this.accessor = new BoxAccessor({ tokenManager: tm })\n this.index = new RAMIndexCacheStore({ ttl: 86_400 })\n }\n\n open(): Promise<void> {\n return Promise.resolve()\n }\n\n close(): Promise<void> {\n return Promise.resolve()\n }\n\n commands(): readonly RegisteredCommand[] {\n return BOX_COMMANDS\n }\n\n ops(): readonly RegisteredOp[] {\n return BOX_VFS_OPS\n }\n\n readFile(p: PathSpec): Promise<Uint8Array> {\n return boxRead(this.accessor, p, this.index)\n }\n\n readdir(p: PathSpec): Promise<string[]> {\n return boxReaddir(this.accessor, p, this.index)\n }\n\n stat(p: PathSpec): Promise<FileStat> {\n return boxStat(this.accessor, p, this.index)\n }\n\n async fingerprint(p: PathSpec): Promise<string | null> {\n const lookup = await this.index.get(p.original)\n return lookup.entry?.remoteTime ?? null\n }\n\n glob(paths: readonly PathSpec[], prefix = ''): Promise<PathSpec[]> {\n const effective =\n prefix !== ''\n ? paths.map((p) =>\n p.prefix !== ''\n ? p\n : new PathSpec({\n original: p.original,\n directory: p.directory,\n ...(p.pattern !== null ? { pattern: p.pattern } : {}),\n resolved: p.resolved,\n prefix,\n }),\n )\n : paths\n return boxResolveGlob(this.accessor, effective, this.index)\n }\n\n getState(): Promise<BoxResourceState> {\n return Promise.resolve({\n type: this.kind,\n needsOverride: true,\n redactedFields: ['clientSecret', 'refreshToken', 'accessToken'],\n config: redactBoxConfig(this.config),\n })\n }\n\n loadState(_state: BoxResourceState): Promise<void> {\n return Promise.resolve()\n }\n}\n"],"mappings":";;;;;AAcA;AAAA,EACE;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EAGA;AAAA,EACA;AAAA,EAIA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,OACK;AAUA,IAAM,cAAN,MAAsC;AAAA,EAClC,OAAe,aAAa;AAAA,EAC5B,WAAoB;AAAA,EACpB,WAAmB;AAAA,EACnB,SAAiB;AAAA,EACjB;AAAA,EACA;AAAA,EACA;AAAA,EAET,YAAY,QAAmB;AAC7B,SAAK,SAAS;AACd,UAAM,KAAK,IAAI,gBAAgB;AAAA,MAC7B,GAAI,OAAO,aAAa,SAAY,EAAE,UAAU,OAAO,SAAS,IAAI,CAAC;AAAA,MACrE,GAAI,OAAO,iBAAiB,SAAY,EAAE,cAAc,OAAO,aAAa,IAAI,CAAC;AAAA,MACjF,GAAI,OAAO,iBAAiB,SAAY,EAAE,cAAc,OAAO,aAAa,IAAI,CAAC;AAAA,MACjF,GAAI,OAAO,gBAAgB,SAAY,EAAE,aAAa,OAAO,YAAY,IAAI,CAAC;AAAA,MAC9E,GAAI,OAAO,cAAc,SAAY,EAAE,WAAW,OAAO,UAAU,IAAI,CAAC;AAAA,MACxE,GAAI,OAAO,0BAA0B,SACjC,EAAE,uBAAuB,OAAO,sBAAsB,IACtD,CAAC;AAAA,IACP,CAAC;AACD,SAAK,WAAW,IAAI,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B,KAAK,MAAM;AAAA,IACrC,CAAC;AAAA,EACH;AAAA,EAEA,UAAU,QAAyC;AACjD,WAAO,QAAQ,QAAQ;AAAA,EACzB;AACF;","names":[]}
|
|
@@ -0,0 +1,99 @@
|
|
|
1
|
+
// src/resource/slack/slack.ts
|
|
2
|
+
import {
|
|
3
|
+
BrowserSlackTransport,
|
|
4
|
+
PathSpec,
|
|
5
|
+
RAMIndexCacheStore,
|
|
6
|
+
ResourceName,
|
|
7
|
+
resolveSlackGlob,
|
|
8
|
+
SLACK_COMMANDS,
|
|
9
|
+
SLACK_PROMPT,
|
|
10
|
+
SLACK_VFS_OPS,
|
|
11
|
+
SLACK_WRITE_PROMPT,
|
|
12
|
+
SlackAccessor,
|
|
13
|
+
slackRead,
|
|
14
|
+
slackReaddir,
|
|
15
|
+
slackStat
|
|
16
|
+
} from "@struktoai/mirage-core";
|
|
17
|
+
|
|
18
|
+
// src/resource/slack/config.ts
|
|
19
|
+
function redactSlackConfig(config) {
|
|
20
|
+
const out = { proxyUrl: config.proxyUrl };
|
|
21
|
+
if (config.getHeaders !== void 0) out.getHeaders = "<REDACTED>";
|
|
22
|
+
return out;
|
|
23
|
+
}
|
|
24
|
+
|
|
25
|
+
// src/resource/slack/slack.ts
|
|
26
|
+
var SlackResource = class {
|
|
27
|
+
kind = ResourceName.SLACK;
|
|
28
|
+
isRemote = true;
|
|
29
|
+
indexTtl = 600;
|
|
30
|
+
prompt = SLACK_PROMPT;
|
|
31
|
+
writePrompt = SLACK_WRITE_PROMPT;
|
|
32
|
+
config;
|
|
33
|
+
accessor;
|
|
34
|
+
index;
|
|
35
|
+
constructor(config) {
|
|
36
|
+
this.config = config;
|
|
37
|
+
this.accessor = new SlackAccessor(
|
|
38
|
+
new BrowserSlackTransport({
|
|
39
|
+
proxyUrl: config.proxyUrl,
|
|
40
|
+
...config.getHeaders !== void 0 ? { getHeaders: config.getHeaders } : {}
|
|
41
|
+
})
|
|
42
|
+
);
|
|
43
|
+
this.index = new RAMIndexCacheStore({ ttl: this.indexTtl });
|
|
44
|
+
}
|
|
45
|
+
open() {
|
|
46
|
+
return Promise.resolve();
|
|
47
|
+
}
|
|
48
|
+
close() {
|
|
49
|
+
return Promise.resolve();
|
|
50
|
+
}
|
|
51
|
+
commands() {
|
|
52
|
+
return SLACK_COMMANDS;
|
|
53
|
+
}
|
|
54
|
+
ops() {
|
|
55
|
+
return SLACK_VFS_OPS;
|
|
56
|
+
}
|
|
57
|
+
readFile(p) {
|
|
58
|
+
return slackRead(this.accessor, p, this.index);
|
|
59
|
+
}
|
|
60
|
+
readdir(p) {
|
|
61
|
+
return slackReaddir(this.accessor, p, this.index);
|
|
62
|
+
}
|
|
63
|
+
stat(p) {
|
|
64
|
+
return slackStat(this.accessor, p, this.index);
|
|
65
|
+
}
|
|
66
|
+
async fingerprint(p) {
|
|
67
|
+
const lookup = await this.index.get(p.original);
|
|
68
|
+
return lookup.entry?.remoteTime ?? null;
|
|
69
|
+
}
|
|
70
|
+
glob(paths, prefix = "") {
|
|
71
|
+
const effective = prefix !== "" ? paths.map(
|
|
72
|
+
(p) => p.prefix !== "" ? p : new PathSpec({
|
|
73
|
+
original: p.original,
|
|
74
|
+
directory: p.directory,
|
|
75
|
+
...p.pattern !== null ? { pattern: p.pattern } : {},
|
|
76
|
+
resolved: p.resolved,
|
|
77
|
+
prefix
|
|
78
|
+
})
|
|
79
|
+
) : paths;
|
|
80
|
+
return resolveSlackGlob(this.accessor, effective, this.index);
|
|
81
|
+
}
|
|
82
|
+
getState() {
|
|
83
|
+
return Promise.resolve({
|
|
84
|
+
type: this.kind,
|
|
85
|
+
needsOverride: true,
|
|
86
|
+
redactedFields: ["getHeaders"],
|
|
87
|
+
config: redactSlackConfig(this.config)
|
|
88
|
+
});
|
|
89
|
+
}
|
|
90
|
+
loadState(_state) {
|
|
91
|
+
return Promise.resolve();
|
|
92
|
+
}
|
|
93
|
+
};
|
|
94
|
+
|
|
95
|
+
export {
|
|
96
|
+
redactSlackConfig,
|
|
97
|
+
SlackResource
|
|
98
|
+
};
|
|
99
|
+
//# sourceMappingURL=chunk-DPC7QRYO.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../src/resource/slack/slack.ts","../src/resource/slack/config.ts"],"sourcesContent":["// ========= Copyright 2026 @ Strukto.AI All Rights Reserved. =========\n// Licensed under the Apache License, Version 2.0 (the \"License\");\n// you may not use this file except in compliance with the License.\n// You may obtain a copy of the License at\n//\n// http://www.apache.org/licenses/LICENSE-2.0\n//\n// Unless required by applicable law or agreed to in writing, software\n// distributed under the License is distributed on an \"AS IS\" BASIS,\n// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n// See the License for the specific language governing permissions and\n// limitations under the License.\n// ========= Copyright 2026 @ Strukto.AI All Rights Reserved. =========\n\nimport {\n BrowserSlackTransport,\n type FileStat,\n type IndexCacheStore,\n PathSpec,\n RAMIndexCacheStore,\n type RegisteredCommand,\n type RegisteredOp,\n type Resource,\n ResourceName,\n resolveSlackGlob,\n SLACK_COMMANDS,\n SLACK_PROMPT,\n SLACK_VFS_OPS,\n SLACK_WRITE_PROMPT,\n SlackAccessor,\n slackRead,\n slackReaddir,\n slackStat,\n} from '@struktoai/mirage-core'\nimport { redactSlackConfig, type SlackConfig, type SlackConfigRedacted } from './config.ts'\n\nexport interface SlackResourceState {\n type: string\n needsOverride: boolean\n redactedFields: readonly string[]\n config: SlackConfigRedacted\n}\n\nexport class SlackResource implements Resource {\n readonly kind: string = ResourceName.SLACK\n readonly isRemote: boolean = true\n readonly indexTtl: number = 600\n readonly prompt: string = SLACK_PROMPT\n readonly writePrompt: string = SLACK_WRITE_PROMPT\n readonly config: SlackConfig\n readonly accessor: SlackAccessor\n readonly index: IndexCacheStore\n\n constructor(config: SlackConfig) {\n this.config = config\n this.accessor = new SlackAccessor(\n new BrowserSlackTransport({\n proxyUrl: config.proxyUrl,\n ...(config.getHeaders !== undefined ? { getHeaders: config.getHeaders } : {}),\n }),\n )\n this.index = new RAMIndexCacheStore({ ttl: this.indexTtl })\n }\n\n open(): Promise<void> {\n return Promise.resolve()\n }\n\n close(): Promise<void> {\n return Promise.resolve()\n }\n\n commands(): readonly RegisteredCommand[] {\n return SLACK_COMMANDS\n }\n\n ops(): readonly RegisteredOp[] {\n return SLACK_VFS_OPS\n }\n\n readFile(p: PathSpec): Promise<Uint8Array> {\n return slackRead(this.accessor, p, this.index)\n }\n\n readdir(p: PathSpec): Promise<string[]> {\n return slackReaddir(this.accessor, p, this.index)\n }\n\n stat(p: PathSpec): Promise<FileStat> {\n return slackStat(this.accessor, p, this.index)\n }\n\n async fingerprint(p: PathSpec): Promise<string | null> {\n const lookup = await this.index.get(p.original)\n return lookup.entry?.remoteTime ?? null\n }\n\n glob(paths: readonly PathSpec[], prefix = ''): Promise<PathSpec[]> {\n const effective =\n prefix !== ''\n ? paths.map((p) =>\n p.prefix !== ''\n ? p\n : new PathSpec({\n original: p.original,\n directory: p.directory,\n ...(p.pattern !== null ? { pattern: p.pattern } : {}),\n resolved: p.resolved,\n prefix,\n }),\n )\n : paths\n return resolveSlackGlob(this.accessor, effective, this.index)\n }\n\n getState(): Promise<SlackResourceState> {\n return Promise.resolve({\n type: this.kind,\n needsOverride: true,\n redactedFields: ['getHeaders'],\n config: redactSlackConfig(this.config),\n })\n }\n\n loadState(_state: SlackResourceState): Promise<void> {\n return Promise.resolve()\n }\n}\n","// ========= Copyright 2026 @ Strukto.AI All Rights Reserved. =========\n// Licensed under the Apache License, Version 2.0 (the \"License\");\n// you may not use this file except in compliance with the License.\n// You may obtain a copy of the License at\n//\n// http://www.apache.org/licenses/LICENSE-2.0\n//\n// Unless required by applicable law or agreed to in writing, software\n// distributed under the License is distributed on an \"AS IS\" BASIS,\n// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n// See the License for the specific language governing permissions and\n// limitations under the License.\n// ========= Copyright 2026 @ Strukto.AI All Rights Reserved. =========\n\nexport interface SlackConfig {\n proxyUrl: string\n getHeaders?: () => Promise<Record<string, string>> | Record<string, string>\n}\n\nexport interface SlackConfigRedacted {\n proxyUrl: string\n getHeaders?: '<REDACTED>'\n}\n\nexport function redactSlackConfig(config: SlackConfig): SlackConfigRedacted {\n const out: SlackConfigRedacted = { proxyUrl: config.proxyUrl }\n if (config.getHeaders !== undefined) out.getHeaders = '<REDACTED>'\n return out\n}\n"],"mappings":";AAcA;AAAA,EACE;AAAA,EAGA;AAAA,EACA;AAAA,EAIA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,OACK;;;ACTA,SAAS,kBAAkB,QAA0C;AAC1E,QAAM,MAA2B,EAAE,UAAU,OAAO,SAAS;AAC7D,MAAI,OAAO,eAAe,OAAW,KAAI,aAAa;AACtD,SAAO;AACT;;;ADeO,IAAM,gBAAN,MAAwC;AAAA,EACpC,OAAe,aAAa;AAAA,EAC5B,WAAoB;AAAA,EACpB,WAAmB;AAAA,EACnB,SAAiB;AAAA,EACjB,cAAsB;AAAA,EACtB;AAAA,EACA;AAAA,EACA;AAAA,EAET,YAAY,QAAqB;AAC/B,SAAK,SAAS;AACd,SAAK,WAAW,IAAI;AAAA,MAClB,IAAI,sBAAsB;AAAA,QACxB,UAAU,OAAO;AAAA,QACjB,GAAI,OAAO,eAAe,SAAY,EAAE,YAAY,OAAO,WAAW,IAAI,CAAC;AAAA,MAC7E,CAAC;AAAA,IACH;AACA,SAAK,QAAQ,IAAI,mBAAmB,EAAE,KAAK,KAAK,SAAS,CAAC;AAAA,EAC5D;AAAA,EAEA,OAAsB;AACpB,WAAO,QAAQ,QAAQ;AAAA,EACzB;AAAA,EAEA,QAAuB;AACrB,WAAO,QAAQ,QAAQ;AAAA,EACzB;AAAA,EAEA,WAAyC;AACvC,WAAO;AAAA,EACT;AAAA,EAEA,MAA+B;AAC7B,WAAO;AAAA,EACT;AAAA,EAEA,SAAS,GAAkC;AACz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