@caracalai/core 0.1.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/LICENSE +201 -0
- package/dist/cliconfig.d.ts +30 -0
- package/dist/cliconfig.d.ts.map +1 -0
- package/dist/cliconfig.js +53 -0
- package/dist/cliconfig.js.map +1 -0
- package/dist/config.d.ts +11 -0
- package/dist/config.d.ts.map +1 -0
- package/dist/config.js +23 -0
- package/dist/config.js.map +1 -0
- package/dist/crypto.d.ts +14 -0
- package/dist/crypto.d.ts.map +1 -0
- package/dist/crypto.js +78 -0
- package/dist/crypto.js.map +1 -0
- package/dist/env.d.ts +3 -0
- package/dist/env.d.ts.map +1 -0
- package/dist/env.js +12 -0
- package/dist/env.js.map +1 -0
- package/dist/envfile.d.ts +3 -0
- package/dist/envfile.d.ts.map +1 -0
- package/dist/envfile.js +40 -0
- package/dist/envfile.js.map +1 -0
- package/dist/errors.d.ts +12 -0
- package/dist/errors.d.ts.map +1 -0
- package/dist/errors.js +22 -0
- package/dist/errors.js.map +1 -0
- package/dist/index.d.ts +8 -0
- package/dist/index.d.ts.map +1 -0
- package/dist/index.js +12 -0
- package/dist/index.js.map +1 -0
- package/dist/logging.d.ts +10 -0
- package/dist/logging.d.ts.map +1 -0
- package/dist/logging.js +23 -0
- package/dist/logging.js.map +1 -0
- package/dist/scope.d.ts +4 -0
- package/dist/scope.d.ts.map +1 -0
- package/dist/scope.js +33 -0
- package/dist/scope.js.map +1 -0
- package/package.json +40 -0
package/LICENSE
ADDED
|
@@ -0,0 +1,201 @@
|
|
|
1
|
+
Apache License
|
|
2
|
+
Version 2.0, January 2004
|
|
3
|
+
http://www.apache.org/licenses/
|
|
4
|
+
|
|
5
|
+
TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION
|
|
6
|
+
|
|
7
|
+
1. Definitions.
|
|
8
|
+
|
|
9
|
+
"License" shall mean the terms and conditions for use, reproduction,
|
|
10
|
+
and distribution as defined by Sections 1 through 9 of this document.
|
|
11
|
+
|
|
12
|
+
"Licensor" shall mean the copyright owner or entity authorized by
|
|
13
|
+
the copyright owner that is granting the License.
|
|
14
|
+
|
|
15
|
+
"Legal Entity" shall mean the union of the acting entity and all
|
|
16
|
+
other entities that control, are controlled by, or are under common
|
|
17
|
+
control with that entity. For the purposes of this definition,
|
|
18
|
+
"control" means (i) the power, direct or indirect, to cause the
|
|
19
|
+
direction or management of such entity, whether by contract or
|
|
20
|
+
otherwise, or (ii) ownership of fifty percent (50%) or more of the
|
|
21
|
+
outstanding shares, or (iii) beneficial ownership of such entity.
|
|
22
|
+
|
|
23
|
+
"You" (or "Your") shall mean an individual or Legal Entity
|
|
24
|
+
exercising permissions granted by this License.
|
|
25
|
+
|
|
26
|
+
"Source" form shall mean the preferred form for making modifications,
|
|
27
|
+
including but not limited to software source code, documentation
|
|
28
|
+
source, and configuration files.
|
|
29
|
+
|
|
30
|
+
"Object" form shall mean any form resulting from mechanical
|
|
31
|
+
transformation or translation of a Source form, including but
|
|
32
|
+
not limited to compiled object code, generated documentation,
|
|
33
|
+
and conversions to other media types.
|
|
34
|
+
|
|
35
|
+
"Work" shall mean the work of authorship, whether in Source or
|
|
36
|
+
Object form, made available under the License, as indicated by a
|
|
37
|
+
copyright notice that is included in or attached to the work
|
|
38
|
+
(an example is provided in the Appendix below).
|
|
39
|
+
|
|
40
|
+
"Derivative Works" shall mean any work, whether in Source or Object
|
|
41
|
+
form, that is based on (or derived from) the Work and for which the
|
|
42
|
+
editorial revisions, annotations, elaborations, or other modifications
|
|
43
|
+
represent, as a whole, an original work of authorship. For the purposes
|
|
44
|
+
of this License, Derivative Works shall not include works that remain
|
|
45
|
+
separable from, or merely link (or bind by name) to the interfaces of,
|
|
46
|
+
the Work and Derivative Works thereof.
|
|
47
|
+
|
|
48
|
+
"Contribution" shall mean any work of authorship, including
|
|
49
|
+
the original version of the Work and any modifications or additions
|
|
50
|
+
to that Work or Derivative Works thereof, that is intentionally
|
|
51
|
+
submitted to Licensor for inclusion in the Work by the copyright owner
|
|
52
|
+
or by an individual or Legal Entity authorized to submit on behalf of
|
|
53
|
+
the copyright owner. For the purposes of this definition, "submitted"
|
|
54
|
+
means any form of electronic, verbal, or written communication sent
|
|
55
|
+
to the Licensor or its representatives, including but not limited to
|
|
56
|
+
communication on electronic mailing lists, source code control systems,
|
|
57
|
+
and issue tracking systems that are managed by, or on behalf of, the
|
|
58
|
+
Licensor for the purpose of discussing and improving the Work, but
|
|
59
|
+
excluding communication that is conspicuously marked or otherwise
|
|
60
|
+
designated in writing by the copyright owner as "Not a Contribution."
|
|
61
|
+
|
|
62
|
+
"Contributor" shall mean Licensor and any individual or Legal Entity
|
|
63
|
+
on behalf of whom a Contribution has been received by Licensor and
|
|
64
|
+
subsequently incorporated within the Work.
|
|
65
|
+
|
|
66
|
+
2. Grant of Copyright License. Subject to the terms and conditions of
|
|
67
|
+
this License, each Contributor hereby grants to You a perpetual,
|
|
68
|
+
worldwide, non-exclusive, no-charge, royalty-free, irrevocable
|
|
69
|
+
copyright license to reproduce, prepare Derivative Works of,
|
|
70
|
+
publicly display, publicly perform, sublicense, and distribute the
|
|
71
|
+
Work and such Derivative Works in Source or Object form.
|
|
72
|
+
|
|
73
|
+
3. Grant of Patent License. Subject to the terms and conditions of
|
|
74
|
+
this License, each Contributor hereby grants to You a perpetual,
|
|
75
|
+
worldwide, non-exclusive, no-charge, royalty-free, irrevocable
|
|
76
|
+
(except as stated in this section) patent license to make, have made,
|
|
77
|
+
use, offer to sell, sell, import, and otherwise transfer the Work,
|
|
78
|
+
where such license applies only to those patent claims licensable
|
|
79
|
+
by such Contributor that are necessarily infringed by their
|
|
80
|
+
Contribution(s) alone or by combination of their Contribution(s)
|
|
81
|
+
with the Work to which such Contribution(s) was submitted. If You
|
|
82
|
+
institute patent litigation against any entity (including a
|
|
83
|
+
cross-claim or counterclaim in a lawsuit) alleging that the Work
|
|
84
|
+
or a Contribution incorporated within the Work constitutes direct
|
|
85
|
+
or contributory patent infringement, then any patent licenses
|
|
86
|
+
granted to You under this License for that Work shall terminate
|
|
87
|
+
as of the date such litigation is filed.
|
|
88
|
+
|
|
89
|
+
4. Redistribution. You may reproduce and distribute copies of the
|
|
90
|
+
Work or Derivative Works thereof in any medium, with or without
|
|
91
|
+
modifications, and in Source or Object form, provided that You
|
|
92
|
+
meet the following conditions:
|
|
93
|
+
|
|
94
|
+
(a) You must give any other recipients of the Work or
|
|
95
|
+
Derivative Works a copy of this License; and
|
|
96
|
+
|
|
97
|
+
(b) You must cause any modified files to carry prominent notices
|
|
98
|
+
stating that You changed the files; and
|
|
99
|
+
|
|
100
|
+
(c) You must retain, in the Source form of any Derivative Works
|
|
101
|
+
that You distribute, all copyright, patent, trademark, and
|
|
102
|
+
attribution notices from the Source form of the Work,
|
|
103
|
+
excluding those notices that do not pertain to any part of
|
|
104
|
+
the Derivative Works; and
|
|
105
|
+
|
|
106
|
+
(d) If the Work includes a "NOTICE" text file as part of its
|
|
107
|
+
distribution, then any Derivative Works that You distribute must
|
|
108
|
+
include a readable copy of the attribution notices contained
|
|
109
|
+
within such NOTICE file, excluding those notices that do not
|
|
110
|
+
pertain to any part of the Derivative Works, in at least one
|
|
111
|
+
of the following places: within a NOTICE text file distributed
|
|
112
|
+
as part of the Derivative Works; within the Source form or
|
|
113
|
+
documentation, if provided along with the Derivative Works; or,
|
|
114
|
+
within a display generated by the Derivative Works, if and
|
|
115
|
+
wherever such third-party notices normally appear. The contents
|
|
116
|
+
of the NOTICE file are for informational purposes only and
|
|
117
|
+
do not modify the License. You may add Your own attribution
|
|
118
|
+
notices within Derivative Works that You distribute, alongside
|
|
119
|
+
or as an addendum to the NOTICE text from the Work, provided
|
|
120
|
+
that such additional attribution notices cannot be construed
|
|
121
|
+
as modifying the License.
|
|
122
|
+
|
|
123
|
+
You may add Your own copyright statement to Your modifications and
|
|
124
|
+
may provide additional or different license terms and conditions
|
|
125
|
+
for use, reproduction, or distribution of Your modifications, or
|
|
126
|
+
for any such Derivative Works as a whole, provided Your use,
|
|
127
|
+
reproduction, and distribution of the Work otherwise complies with
|
|
128
|
+
the conditions stated in this License.
|
|
129
|
+
|
|
130
|
+
5. Submission of Contributions. Unless You explicitly state otherwise,
|
|
131
|
+
any Contribution intentionally submitted for inclusion in the Work
|
|
132
|
+
by You to the Licensor shall be under the terms and conditions of
|
|
133
|
+
this License, without any additional terms or conditions.
|
|
134
|
+
Notwithstanding the above, nothing herein shall supersede or modify
|
|
135
|
+
the terms of any separate license agreement you may have executed
|
|
136
|
+
with Licensor regarding such Contributions.
|
|
137
|
+
|
|
138
|
+
6. Trademarks. This License does not grant permission to use the trade
|
|
139
|
+
names, trademarks, service marks, or product names of the Licensor,
|
|
140
|
+
except as required for reasonable and customary use in describing the
|
|
141
|
+
origin of the Work and reproducing the content of the NOTICE file.
|
|
142
|
+
|
|
143
|
+
7. Disclaimer of Warranty. Unless required by applicable law or
|
|
144
|
+
agreed to in writing, Licensor provides the Work (and each
|
|
145
|
+
Contributor provides its Contributions) on an "AS IS" BASIS,
|
|
146
|
+
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
|
|
147
|
+
implied, including, without limitation, any warranties or conditions
|
|
148
|
+
of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A
|
|
149
|
+
PARTICULAR PURPOSE. You are solely responsible for determining the
|
|
150
|
+
appropriateness of using or redistributing the Work and assume any
|
|
151
|
+
risks associated with Your exercise of permissions under this License.
|
|
152
|
+
|
|
153
|
+
8. Limitation of Liability. In no event and under no legal theory,
|
|
154
|
+
whether in tort (including negligence), contract, or otherwise,
|
|
155
|
+
unless required by applicable law (such as deliberate and grossly
|
|
156
|
+
negligent acts) or agreed to in writing, shall any Contributor be
|
|
157
|
+
liable to You for damages, including any direct, indirect, special,
|
|
158
|
+
incidental, or consequential damages of any character arising as a
|
|
159
|
+
result of this License or out of the use or inability to use the
|
|
160
|
+
Work (including but not limited to damages for loss of goodwill,
|
|
161
|
+
work stoppage, computer failure or malfunction, or any and all
|
|
162
|
+
other commercial damages or losses), even if such Contributor
|
|
163
|
+
has been advised of the possibility of such damages.
|
|
164
|
+
|
|
165
|
+
9. Accepting Warranty or Additional Liability. While redistributing
|
|
166
|
+
the Work or Derivative Works thereof, You may choose to offer,
|
|
167
|
+
and charge a fee for, acceptance of support, warranty, indemnity,
|
|
168
|
+
or other liability obligations and/or rights consistent with this
|
|
169
|
+
License. However, in accepting such obligations, You may act only
|
|
170
|
+
on Your own behalf and on Your sole responsibility, not on behalf
|
|
171
|
+
of any other Contributor, and only if You agree to indemnify,
|
|
172
|
+
defend, and hold each Contributor harmless for any liability
|
|
173
|
+
incurred by, or claims asserted against, such Contributor by reason
|
|
174
|
+
of your accepting any such warranty or additional liability.
|
|
175
|
+
|
|
176
|
+
END OF TERMS AND CONDITIONS
|
|
177
|
+
|
|
178
|
+
APPENDIX: How to apply the Apache License to your work.
|
|
179
|
+
|
|
180
|
+
To apply the Apache License to your work, attach the following
|
|
181
|
+
boilerplate notice, with the fields enclosed by brackets "[]"
|
|
182
|
+
replaced with your own identifying information. (Don't include
|
|
183
|
+
the brackets!) The text should be enclosed in the appropriate
|
|
184
|
+
comment syntax for the file format. We also recommend that a
|
|
185
|
+
file or class name and description of purpose be included on the
|
|
186
|
+
same "printed page" as the copyright notice for easier
|
|
187
|
+
identification within third-party archives.
|
|
188
|
+
|
|
189
|
+
Copyright [2026] [Garudex Labs]
|
|
190
|
+
|
|
191
|
+
Licensed under the Apache License, Version 2.0 (the "License");
|
|
192
|
+
you may not use this file except in compliance with the License.
|
|
193
|
+
You may obtain a copy of the License at
|
|
194
|
+
|
|
195
|
+
http://www.apache.org/licenses/LICENSE-2.0
|
|
196
|
+
|
|
197
|
+
Unless required by applicable law or agreed to in writing, software
|
|
198
|
+
distributed under the License is distributed on an "AS IS" BASIS,
|
|
199
|
+
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
200
|
+
See the License for the specific language governing permissions and
|
|
201
|
+
limitations under the License.
|
|
@@ -0,0 +1,30 @@
|
|
|
1
|
+
export declare const DEFAULT_API_URL = "http://localhost:3000";
|
|
2
|
+
export declare const DEFAULT_COORDINATOR_URL = "http://localhost:4000";
|
|
3
|
+
export interface Credential {
|
|
4
|
+
env: string;
|
|
5
|
+
resource: string;
|
|
6
|
+
}
|
|
7
|
+
export interface OptionalCredential extends Credential {
|
|
8
|
+
on_failure: 'warn' | 'error';
|
|
9
|
+
}
|
|
10
|
+
export interface McpGovernance {
|
|
11
|
+
mode: 'block' | 'log';
|
|
12
|
+
}
|
|
13
|
+
export interface CliConfig {
|
|
14
|
+
zone_url: string;
|
|
15
|
+
zone_id: string;
|
|
16
|
+
application_id: string;
|
|
17
|
+
app_client_secret: string;
|
|
18
|
+
continue_on_failure?: boolean;
|
|
19
|
+
credentials?: Credential[];
|
|
20
|
+
optional_credentials?: OptionalCredential[];
|
|
21
|
+
mcp_governance?: McpGovernance;
|
|
22
|
+
}
|
|
23
|
+
export declare function resolveCliConfigPath(env?: NodeJS.ProcessEnv): string | undefined;
|
|
24
|
+
export declare class ServiceUrlMissingError extends Error {
|
|
25
|
+
readonly envKey: string;
|
|
26
|
+
readonly nodeEnv: string;
|
|
27
|
+
constructor(envKey: string, nodeEnv: string);
|
|
28
|
+
}
|
|
29
|
+
export declare function resolveServiceUrl(envKey: string, devDefault: string): string;
|
|
30
|
+
//# sourceMappingURL=cliconfig.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"cliconfig.d.ts","sourceRoot":"","sources":["../src/cliconfig.ts"],"names":[],"mappings":"AASA,eAAO,MAAM,eAAe,0BAA0B,CAAC;AACvD,eAAO,MAAM,uBAAuB,0BAA0B,CAAC;AAE/D,MAAM,WAAW,UAAU;IACzB,GAAG,EAAE,MAAM,CAAC;IACZ,QAAQ,EAAE,MAAM,CAAC;CAClB;AAED,MAAM,WAAW,kBAAmB,SAAQ,UAAU;IACpD,UAAU,EAAE,MAAM,GAAG,OAAO,CAAC;CAC9B;AAED,MAAM,WAAW,aAAa;IAC5B,IAAI,EAAE,OAAO,GAAG,KAAK,CAAC;CACvB;AAED,MAAM,WAAW,SAAS;IACxB,QAAQ,EAAE,MAAM,CAAC;IACjB,OAAO,EAAE,MAAM,CAAC;IAChB,cAAc,EAAE,MAAM,CAAC;IACvB,iBAAiB,EAAE,MAAM,CAAC;IAC1B,mBAAmB,CAAC,EAAE,OAAO,CAAC;IAC9B,WAAW,CAAC,EAAE,UAAU,EAAE,CAAC;IAC3B,oBAAoB,CAAC,EAAE,kBAAkB,EAAE,CAAC;IAC5C,cAAc,CAAC,EAAE,aAAa,CAAC;CAChC;AAKD,wBAAgB,oBAAoB,CAAC,GAAG,GAAE,MAAM,CAAC,UAAwB,GAAG,MAAM,GAAG,SAAS,CAc7F;AAED,qBAAa,sBAAuB,SAAQ,KAAK;aACnB,MAAM,EAAE,MAAM;aAAkB,OAAO,EAAE,MAAM;gBAA/C,MAAM,EAAE,MAAM,EAAkB,OAAO,EAAE,MAAM;CAI5E;AAID,wBAAgB,iBAAiB,CAAC,MAAM,EAAE,MAAM,EAAE,UAAU,EAAE,MAAM,GAAG,MAAM,CAQ5E"}
|
|
@@ -0,0 +1,53 @@
|
|
|
1
|
+
// Copyright (C) 2026 Garudex Labs. All Rights Reserved.
|
|
2
|
+
// Caracal, a product of Garudex Labs
|
|
3
|
+
//
|
|
4
|
+
// Shared CLI/TUI helpers: caracal.toml discovery and service URL resolution.
|
|
5
|
+
import { existsSync } from 'node:fs';
|
|
6
|
+
import { homedir } from 'node:os';
|
|
7
|
+
import { join } from 'node:path';
|
|
8
|
+
export const DEFAULT_API_URL = 'http://localhost:3000';
|
|
9
|
+
export const DEFAULT_COORDINATOR_URL = 'http://localhost:4000';
|
|
10
|
+
// Resolves the path to caracal.toml using the documented precedence:
|
|
11
|
+
// $CARACAL_CONFIG → ./caracal.toml (cwd / $PWD / $INIT_CWD) → $XDG_CONFIG_HOME/caracal/caracal.toml
|
|
12
|
+
// Returns undefined when no candidate exists on disk.
|
|
13
|
+
export function resolveCliConfigPath(env = process.env) {
|
|
14
|
+
const candidates = [];
|
|
15
|
+
if (env.CARACAL_CONFIG)
|
|
16
|
+
candidates.push(env.CARACAL_CONFIG);
|
|
17
|
+
for (const dir of [process.cwd(), env.PWD, env.INIT_CWD]) {
|
|
18
|
+
if (dir)
|
|
19
|
+
candidates.push(join(dir, 'caracal.toml'));
|
|
20
|
+
}
|
|
21
|
+
const xdg = env.XDG_CONFIG_HOME && env.XDG_CONFIG_HOME.length > 0
|
|
22
|
+
? env.XDG_CONFIG_HOME
|
|
23
|
+
: join(homedir(), '.config');
|
|
24
|
+
candidates.push(join(xdg, 'caracal', 'caracal.toml'));
|
|
25
|
+
for (const path of candidates) {
|
|
26
|
+
if (existsSync(path))
|
|
27
|
+
return path;
|
|
28
|
+
}
|
|
29
|
+
return undefined;
|
|
30
|
+
}
|
|
31
|
+
export class ServiceUrlMissingError extends Error {
|
|
32
|
+
envKey;
|
|
33
|
+
nodeEnv;
|
|
34
|
+
constructor(envKey, nodeEnv) {
|
|
35
|
+
super(`${envKey} is required when NODE_ENV=${nodeEnv}`);
|
|
36
|
+
this.envKey = envKey;
|
|
37
|
+
this.nodeEnv = nodeEnv;
|
|
38
|
+
this.name = 'ServiceUrlMissingError';
|
|
39
|
+
}
|
|
40
|
+
}
|
|
41
|
+
// Returns the env-var override or the dev default. Throws ServiceUrlMissingError
|
|
42
|
+
// in non-development so a misconfigured production CLI never silently hits localhost.
|
|
43
|
+
export function resolveServiceUrl(envKey, devDefault) {
|
|
44
|
+
const v = process.env[envKey];
|
|
45
|
+
if (v)
|
|
46
|
+
return v;
|
|
47
|
+
const env = process.env.NODE_ENV ?? 'development';
|
|
48
|
+
if (env !== 'development') {
|
|
49
|
+
throw new ServiceUrlMissingError(envKey, env);
|
|
50
|
+
}
|
|
51
|
+
return devDefault;
|
|
52
|
+
}
|
|
53
|
+
//# sourceMappingURL=cliconfig.js.map
|
|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,CAAC;YAAE,OAAO,IAAI,CAAC;IACpC,CAAC;IACD,OAAO,SAAS,CAAC;AACnB,CAAC;AAED,MAAM,OAAO,sBAAuB,SAAQ,KAAK;IACnB;IAAgC;IAA5D,YAA4B,MAAc,EAAkB,OAAe;QACzE,KAAK,CAAC,GAAG,MAAM,8BAA8B,OAAO,EAAE,CAAC,CAAC;QAD9B,WAAM,GAAN,MAAM,CAAQ;QAAkB,YAAO,GAAP,OAAO,CAAQ;QAEzE,IAAI,CAAC,IAAI,GAAG,wBAAwB,CAAC;IACvC,CAAC;CACF;AAED,iFAAiF;AACjF,sFAAsF;AACtF,MAAM,UAAU,iBAAiB,CAAC,MAAc,EAAE,UAAkB;IAClE,MAAM,CAAC,GAAG,OAAO,CAAC,GAAG,CAAC,MAAM,CAAC,CAAC;IAC9B,IAAI,CAAC;QAAE,OAAO,CAAC,CAAC;IAChB,MAAM,GAAG,GAAG,OAAO,CAAC,GAAG,CAAC,QAAQ,IAAI,aAAa,CAAC;IAClD,IAAI,GAAG,KAAK,aAAa,EAAE,CAAC;QAC1B,MAAM,IAAI,sBAAsB,CAAC,MAAM,EAAE,GAAG,CAAC,CAAC;IAChD,CAAC;IACD,OAAO,UAAU,CAAC;AACpB,CAAC"}
|
package/dist/config.d.ts
ADDED
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
export interface BaseConfig {
|
|
2
|
+
port: number;
|
|
3
|
+
databaseUrl: string;
|
|
4
|
+
redisUrl: string;
|
|
5
|
+
stsUrl: string;
|
|
6
|
+
logLevel: string;
|
|
7
|
+
}
|
|
8
|
+
export declare function mustGetenv(key: string): string;
|
|
9
|
+
export declare function getenv(key: string, fallback: string): string;
|
|
10
|
+
export declare function loadBaseConfig(): BaseConfig;
|
|
11
|
+
//# sourceMappingURL=config.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"config.d.ts","sourceRoot":"","sources":["../src/config.ts"],"names":[],"mappings":"AAKA,MAAM,WAAW,UAAU;IACzB,IAAI,EAAE,MAAM,CAAC;IACb,WAAW,EAAE,MAAM,CAAC;IACpB,QAAQ,EAAE,MAAM,CAAC;IACjB,MAAM,EAAE,MAAM,CAAC;IACf,QAAQ,EAAE,MAAM,CAAC;CAClB;AAED,wBAAgB,UAAU,CAAC,GAAG,EAAE,MAAM,GAAG,MAAM,CAI9C;AAED,wBAAgB,MAAM,CAAC,GAAG,EAAE,MAAM,EAAE,QAAQ,EAAE,MAAM,GAAG,MAAM,CAE5D;AAED,wBAAgB,cAAc,IAAI,UAAU,CAQ3C"}
|
package/dist/config.js
ADDED
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
// Copyright (C) 2026 Garudex Labs. All Rights Reserved.
|
|
2
|
+
// Caracal, a product of Garudex Labs
|
|
3
|
+
//
|
|
4
|
+
// Shared configuration loader for TypeScript services.
|
|
5
|
+
export function mustGetenv(key) {
|
|
6
|
+
const v = process.env[key];
|
|
7
|
+
if (!v)
|
|
8
|
+
throw new Error(`Required env var missing: ${key}`);
|
|
9
|
+
return v;
|
|
10
|
+
}
|
|
11
|
+
export function getenv(key, fallback) {
|
|
12
|
+
return process.env[key] ?? fallback;
|
|
13
|
+
}
|
|
14
|
+
export function loadBaseConfig() {
|
|
15
|
+
return {
|
|
16
|
+
port: parseInt(mustGetenv('PORT'), 10),
|
|
17
|
+
databaseUrl: mustGetenv('DATABASE_URL'),
|
|
18
|
+
redisUrl: mustGetenv('REDIS_URL'),
|
|
19
|
+
stsUrl: getenv('STS_URL', 'http://localhost:8080'),
|
|
20
|
+
logLevel: getenv('LOG_LEVEL', 'info'),
|
|
21
|
+
};
|
|
22
|
+
}
|
|
23
|
+
//# sourceMappingURL=config.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"config.js","sourceRoot":"","sources":["../src/config.ts"],"names":[],"mappings":"AAAA,yDAAyD;AACzD,qCAAqC;AACrC,EAAE;AACF,uDAAuD;AAUvD,MAAM,UAAU,UAAU,CAAC,GAAW;IACpC,MAAM,CAAC,GAAG,OAAO,CAAC,GAAG,CAAC,GAAG,CAAC,CAAC;IAC3B,IAAI,CAAC,CAAC;QAAE,MAAM,IAAI,KAAK,CAAC,6BAA6B,GAAG,EAAE,CAAC,CAAC;IAC5D,OAAO,CAAC,CAAC;AACX,CAAC;AAED,MAAM,UAAU,MAAM,CAAC,GAAW,EAAE,QAAgB;IAClD,OAAO,OAAO,CAAC,GAAG,CAAC,GAAG,CAAC,IAAI,QAAQ,CAAC;AACtC,CAAC;AAED,MAAM,UAAU,cAAc;IAC5B,OAAO;QACL,IAAI,EAAE,QAAQ,CAAC,UAAU,CAAC,MAAM,CAAC,EAAE,EAAE,CAAC;QACtC,WAAW,EAAE,UAAU,CAAC,cAAc,CAAC;QACvC,QAAQ,EAAE,UAAU,CAAC,WAAW,CAAC;QACjC,MAAM,EAAE,MAAM,CAAC,SAAS,EAAE,uBAAuB,CAAC;QAClD,QAAQ,EAAE,MAAM,CAAC,WAAW,EAAE,MAAM,CAAC;KACtC,CAAC;AACJ,CAAC"}
|
package/dist/crypto.d.ts
ADDED
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
export interface SealedSecret {
|
|
2
|
+
ciphertext: Buffer;
|
|
3
|
+
nonce: Buffer;
|
|
4
|
+
}
|
|
5
|
+
export declare function sha256(input: string | Buffer): Buffer;
|
|
6
|
+
export declare function sha256Hex(input: string | Buffer): string;
|
|
7
|
+
export declare function loadZoneKek(): Buffer;
|
|
8
|
+
export declare function seal(key: Buffer, plaintext: Buffer): SealedSecret;
|
|
9
|
+
export declare function open(key: Buffer, sealed: SealedSecret): Buffer;
|
|
10
|
+
export declare const STREAM_SIG_FIELD = "_sig";
|
|
11
|
+
export type StreamValue = string | number | boolean | null | undefined;
|
|
12
|
+
export declare function loadStreamsHmacKey(): Buffer | null;
|
|
13
|
+
export declare function signStream(key: Buffer, stream: string, values: Record<string, StreamValue>): string;
|
|
14
|
+
//# sourceMappingURL=crypto.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"crypto.d.ts","sourceRoot":"","sources":["../src/crypto.ts"],"names":[],"mappings":"AAWA,MAAM,WAAW,YAAY;IAC3B,UAAU,EAAE,MAAM,CAAC;IACnB,KAAK,EAAE,MAAM,CAAC;CACf;AAED,wBAAgB,MAAM,CAAC,KAAK,EAAE,MAAM,GAAG,MAAM,GAAG,MAAM,CAErD;AAED,wBAAgB,SAAS,CAAC,KAAK,EAAE,MAAM,GAAG,MAAM,GAAG,MAAM,CAExD;AAED,wBAAgB,WAAW,IAAI,MAAM,CAWpC;AAED,wBAAgB,IAAI,CAAC,GAAG,EAAE,MAAM,EAAE,SAAS,EAAE,MAAM,GAAG,YAAY,CAMjE;AAED,wBAAgB,IAAI,CAAC,GAAG,EAAE,MAAM,EAAE,MAAM,EAAE,YAAY,GAAG,MAAM,CAO9D;AAID,eAAO,MAAM,gBAAgB,SAAS,CAAC;AAEvC,MAAM,MAAM,WAAW,GAAG,MAAM,GAAG,MAAM,GAAG,OAAO,GAAG,IAAI,GAAG,SAAS,CAAC;AAIvE,wBAAgB,kBAAkB,IAAI,MAAM,GAAG,IAAI,CAQlD;AAgBD,wBAAgB,UAAU,CAAC,GAAG,EAAE,MAAM,EAAE,MAAM,EAAE,MAAM,EAAE,MAAM,EAAE,MAAM,CAAC,MAAM,EAAE,WAAW,CAAC,GAAG,MAAM,CAEnG"}
|
package/dist/crypto.js
ADDED
|
@@ -0,0 +1,78 @@
|
|
|
1
|
+
// Copyright (C) 2026 Garudex Labs. All Rights Reserved.
|
|
2
|
+
// Caracal, a product of Garudex Labs
|
|
3
|
+
//
|
|
4
|
+
// ChaCha20-Poly1305 envelope encryption that matches the Go shared/crypto format.
|
|
5
|
+
import { createCipheriv, createDecipheriv, createHash, createHmac, randomBytes } from 'node:crypto';
|
|
6
|
+
const KEY_BYTES = 32;
|
|
7
|
+
const NONCE_BYTES = 12;
|
|
8
|
+
const TAG_BYTES = 16;
|
|
9
|
+
export function sha256(input) {
|
|
10
|
+
return createHash('sha256').update(input).digest();
|
|
11
|
+
}
|
|
12
|
+
export function sha256Hex(input) {
|
|
13
|
+
return createHash('sha256').update(input).digest('hex');
|
|
14
|
+
}
|
|
15
|
+
export function loadZoneKek() {
|
|
16
|
+
const raw = process.env.ZONE_KEK;
|
|
17
|
+
if (!raw)
|
|
18
|
+
throw new Error('ZONE_KEK is required');
|
|
19
|
+
const key = Buffer.from(raw, 'hex');
|
|
20
|
+
if (key.length !== KEY_BYTES) {
|
|
21
|
+
throw new Error(`ZONE_KEK must be ${KEY_BYTES} bytes, got ${key.length}`);
|
|
22
|
+
}
|
|
23
|
+
let allZero = 0;
|
|
24
|
+
for (const b of key)
|
|
25
|
+
allZero |= b;
|
|
26
|
+
if (allZero === 0)
|
|
27
|
+
throw new Error('ZONE_KEK must not be all zeros');
|
|
28
|
+
return key;
|
|
29
|
+
}
|
|
30
|
+
export function seal(key, plaintext) {
|
|
31
|
+
const nonce = randomBytes(NONCE_BYTES);
|
|
32
|
+
const cipher = createCipheriv('chacha20-poly1305', key, nonce, { authTagLength: TAG_BYTES });
|
|
33
|
+
const enc = Buffer.concat([cipher.update(plaintext), cipher.final()]);
|
|
34
|
+
const tag = cipher.getAuthTag();
|
|
35
|
+
return { ciphertext: Buffer.concat([enc, tag]), nonce };
|
|
36
|
+
}
|
|
37
|
+
export function open(key, sealed) {
|
|
38
|
+
if (sealed.ciphertext.length < TAG_BYTES)
|
|
39
|
+
throw new Error('ciphertext too short');
|
|
40
|
+
const tag = sealed.ciphertext.subarray(sealed.ciphertext.length - TAG_BYTES);
|
|
41
|
+
const body = sealed.ciphertext.subarray(0, sealed.ciphertext.length - TAG_BYTES);
|
|
42
|
+
const decipher = createDecipheriv('chacha20-poly1305', key, sealed.nonce, { authTagLength: TAG_BYTES });
|
|
43
|
+
decipher.setAuthTag(tag);
|
|
44
|
+
return Buffer.concat([decipher.update(body), decipher.final()]);
|
|
45
|
+
}
|
|
46
|
+
// STREAM_SIG_FIELD is the reserved key used to carry an HMAC-SHA256 origin signature
|
|
47
|
+
// on Redis stream messages. Mirrors `crypto.StreamSigField` in the Go shared package.
|
|
48
|
+
export const STREAM_SIG_FIELD = '_sig';
|
|
49
|
+
// loadStreamsHmacKey reads STREAMS_HMAC_KEY (hex) and enforces ≥32 bytes. Returns
|
|
50
|
+
// null when unset; callers in production paths must reject null themselves.
|
|
51
|
+
export function loadStreamsHmacKey() {
|
|
52
|
+
const raw = process.env.STREAMS_HMAC_KEY;
|
|
53
|
+
if (!raw)
|
|
54
|
+
return null;
|
|
55
|
+
const key = Buffer.from(raw, 'hex');
|
|
56
|
+
if (key.length < 32) {
|
|
57
|
+
throw new Error('STREAMS_HMAC_KEY must be hex-encoded with at least 32 bytes');
|
|
58
|
+
}
|
|
59
|
+
return key;
|
|
60
|
+
}
|
|
61
|
+
function canonicalizeStream(stream, values) {
|
|
62
|
+
const keys = Object.keys(values).filter((k) => k !== STREAM_SIG_FIELD).sort();
|
|
63
|
+
let out = `${stream}\n`;
|
|
64
|
+
for (const k of keys) {
|
|
65
|
+
const v = values[k];
|
|
66
|
+
if (v === null || v === undefined)
|
|
67
|
+
continue;
|
|
68
|
+
out += `${k}=${String(v)}\n`;
|
|
69
|
+
}
|
|
70
|
+
return out;
|
|
71
|
+
}
|
|
72
|
+
// signStream returns the hex HMAC-SHA256 over the canonical form of the values map.
|
|
73
|
+
// Mirrors `crypto.SignStream` in the Go shared package so producers and consumers
|
|
74
|
+
// across language boundaries agree on the signature.
|
|
75
|
+
export function signStream(key, stream, values) {
|
|
76
|
+
return createHmac('sha256', key).update(canonicalizeStream(stream, values)).digest('hex');
|
|
77
|
+
}
|
|
78
|
+
//# sourceMappingURL=crypto.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"crypto.js","sourceRoot":"","sources":["../src/crypto.ts"],"names":[],"mappings":"AAAA,yDAAyD;AACzD,qCAAqC;AACrC,EAAE;AACF,kFAAkF;AAElF,OAAO,EAA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
+
{"version":3,"file":"env.d.ts","sourceRoot":"","sources":["../src/env.ts"],"names":[],"mappings":"AAKA,wBAAgB,UAAU,IAAI,MAAM,CAEnC;AAED,wBAAgB,YAAY,IAAI,OAAO,CAGtC"}
|
package/dist/env.js
ADDED
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
// Copyright (C) 2026 Garudex Labs. All Rights Reserved.
|
|
2
|
+
// Caracal, a product of Garudex Labs
|
|
3
|
+
//
|
|
4
|
+
// Shared environment classification for TypeScript services.
|
|
5
|
+
export function caracalEnv() {
|
|
6
|
+
return process.env.CARACAL_ENV ?? 'development';
|
|
7
|
+
}
|
|
8
|
+
export function isProduction() {
|
|
9
|
+
const env = caracalEnv();
|
|
10
|
+
return env === 'production' || env === 'prod' || env === 'staging';
|
|
11
|
+
}
|
|
12
|
+
//# sourceMappingURL=env.js.map
|
package/dist/env.js.map
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"env.js","sourceRoot":"","sources":["../src/env.ts"],"names":[],"mappings":"AAAA,yDAAyD;AACzD,qCAAqC;AACrC,EAAE;AACF,6DAA6D;AAE7D,MAAM,UAAU,UAAU;IACxB,OAAO,OAAO,CAAC,GAAG,CAAC,WAAW,IAAI,aAAa,CAAC;AAClD,CAAC;AAED,MAAM,UAAU,YAAY;IAC1B,MAAM,GAAG,GAAG,UAAU,EAAE,CAAC;IACzB,OAAO,GAAG,KAAK,YAAY,IAAI,GAAG,KAAK,MAAM,IAAI,GAAG,KAAK,SAAS,CAAC;AACrE,CAAC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"envfile.d.ts","sourceRoot":"","sources":["../src/envfile.ts"],"names":[],"mappings":"AAQA,wBAAgB,WAAW,CAAC,IAAI,EAAE,MAAM,GAAG,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,CAahE;AAED,wBAAgB,kBAAkB,CAAC,QAAQ,CAAC,EAAE,MAAM,GAAG,MAAM,GAAG,SAAS,CAaxE"}
|
package/dist/envfile.js
ADDED
|
@@ -0,0 +1,40 @@
|
|
|
1
|
+
// Copyright (C) 2026 Garudex Labs. All Rights Reserved.
|
|
2
|
+
// Caracal, a product of Garudex Labs
|
|
3
|
+
//
|
|
4
|
+
// Helpers for reading dotenv files and discovering the Caracal admin token.
|
|
5
|
+
import { existsSync, readFileSync } from 'node:fs';
|
|
6
|
+
import { join } from 'node:path';
|
|
7
|
+
export function readEnvFile(path) {
|
|
8
|
+
if (!existsSync(path))
|
|
9
|
+
return {};
|
|
10
|
+
const out = {};
|
|
11
|
+
for (const line of readFileSync(path, 'utf8').split(/\r?\n/)) {
|
|
12
|
+
const m = line.match(/^\s*([A-Z_][A-Z0-9_]*)\s*=\s*(.*)\s*$/);
|
|
13
|
+
if (!m)
|
|
14
|
+
continue;
|
|
15
|
+
let value = m[2];
|
|
16
|
+
if ((value.startsWith('"') && value.endsWith('"')) || (value.startsWith("'") && value.endsWith("'"))) {
|
|
17
|
+
value = value.slice(1, -1);
|
|
18
|
+
}
|
|
19
|
+
out[m[1]] = value;
|
|
20
|
+
}
|
|
21
|
+
return out;
|
|
22
|
+
}
|
|
23
|
+
export function discoverAdminToken(explicit) {
|
|
24
|
+
if (explicit)
|
|
25
|
+
return explicit;
|
|
26
|
+
if (process.env.CARACAL_ADMIN_TOKEN)
|
|
27
|
+
return process.env.CARACAL_ADMIN_TOKEN;
|
|
28
|
+
const candidates = [
|
|
29
|
+
process.env.CARACAL_ENV_FILE,
|
|
30
|
+
join(process.cwd(), 'infra', 'docker', '.env'),
|
|
31
|
+
join(process.cwd(), '.env'),
|
|
32
|
+
].filter((p) => Boolean(p));
|
|
33
|
+
for (const path of candidates) {
|
|
34
|
+
const env = readEnvFile(path);
|
|
35
|
+
if (env.CARACAL_ADMIN_TOKEN)
|
|
36
|
+
return env.CARACAL_ADMIN_TOKEN;
|
|
37
|
+
}
|
|
38
|
+
return undefined;
|
|
39
|
+
}
|
|
40
|
+
//# sourceMappingURL=envfile.js.map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O,CAAC,GAAG,CAAC,mBAAmB,CAAC;IAC5E,MAAM,UAAU,GAAG;QACjB,OAAO,CAAC,GAAG,CAAC,gBAAgB;QAC5B,IAAI,CAAC,OAAO,CAAC,GAAG,EAAE,EAAE,OAAO,EAAE,QAAQ,EAAE,MAAM,CAAC;QAC9C,IAAI,CAAC,OAAO,CAAC,GAAG,EAAE,EAAE,MAAM,CAAC;KAC5B,CAAC,MAAM,CAAC,CAAC,CAAC,EAAe,EAAE,CAAC,OAAO,CAAC,CAAC,CAAC,CAAC,CAAC;IACzC,KAAK,MAAM,IAAI,IAAI,UAAU,EAAE,CAAC;QAC9B,MAAM,GAAG,GAAG,WAAW,CAAC,IAAI,CAAC,CAAC;QAC9B,IAAI,GAAG,CAAC,mBAAmB;YAAE,OAAO,GAAG,CAAC,mBAAmB,CAAC;IAC9D,CAAC;IACD,OAAO,SAAS,CAAC;AACnB,CAAC"}
|
package/dist/errors.d.ts
ADDED
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
export type ErrorCode = 'access_denied' | 'invalid_token' | 'resource_not_found' | 'internal_error' | 'policy_eval_failed' | 'provider_rate_limited' | 'interaction_required' | 'sts_unavailable' | 'credential_expired_not_renewable' | 'payload_too_large';
|
|
2
|
+
export declare class CaracalError extends Error {
|
|
3
|
+
readonly code: ErrorCode;
|
|
4
|
+
readonly requestId?: string | undefined;
|
|
5
|
+
constructor(code: ErrorCode, message: string, requestId?: string | undefined);
|
|
6
|
+
toJSON(): {
|
|
7
|
+
requestId?: string | undefined;
|
|
8
|
+
error: ErrorCode;
|
|
9
|
+
error_description: string;
|
|
10
|
+
};
|
|
11
|
+
}
|
|
12
|
+
//# sourceMappingURL=errors.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"errors.d.ts","sourceRoot":"","sources":["../src/errors.ts"],"names":[],"mappings":"AAKA,MAAM,MAAM,SAAS,GACjB,eAAe,GACf,eAAe,GACf,oBAAoB,GACpB,gBAAgB,GAChB,oBAAoB,GACpB,uBAAuB,GACvB,sBAAsB,GACtB,iBAAiB,GACjB,kCAAkC,GAClC,mBAAmB,CAAC;AAExB,qBAAa,YAAa,SAAQ,KAAK;aAEnB,IAAI,EAAE,SAAS;aAEf,SAAS,CAAC,EAAE,MAAM;gBAFlB,IAAI,EAAE,SAAS,EAC/B,OAAO,EAAE,MAAM,EACC,SAAS,CAAC,EAAE,MAAM,YAAA;IAMpC,MAAM;;;;;CAOP"}
|
package/dist/errors.js
ADDED
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
// Copyright (C) 2026 Garudex Labs. All Rights Reserved.
|
|
2
|
+
// Caracal, a product of Garudex Labs
|
|
3
|
+
//
|
|
4
|
+
// Shared error codes and types for TypeScript services.
|
|
5
|
+
export class CaracalError extends Error {
|
|
6
|
+
code;
|
|
7
|
+
requestId;
|
|
8
|
+
constructor(code, message, requestId) {
|
|
9
|
+
super(message);
|
|
10
|
+
this.code = code;
|
|
11
|
+
this.requestId = requestId;
|
|
12
|
+
this.name = 'CaracalError';
|
|
13
|
+
}
|
|
14
|
+
toJSON() {
|
|
15
|
+
return {
|
|
16
|
+
error: this.code,
|
|
17
|
+
error_description: this.message,
|
|
18
|
+
...(this.requestId ? { requestId: this.requestId } : {}),
|
|
19
|
+
};
|
|
20
|
+
}
|
|
21
|
+
}
|
|
22
|
+
//# sourceMappingURL=errors.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"errors.js","sourceRoot":"","sources":["../src/errors.ts"],"names":[],"mappings":"AAAA,yDAAyD;AACzD,qCAAqC;AACrC,EAAE;AACF,wDAAwD;AAcxD,MAAM,OAAO,YAAa,SAAQ,KAAK;IAEnB;IAEA;IAHlB,YACkB,IAAe,EAC/B,OAAe,EACC,SAAkB;QAElC,KAAK,CAAC,OAAO,CAAC,CAAC;QAJC,SAAI,GAAJ,IAAI,CAAW;QAEf,cAAS,GAAT,SAAS,CAAS;QAGlC,IAAI,CAAC,IAAI,GAAG,cAAc,CAAC;IAC7B,CAAC;IAED,MAAM;QACJ,OAAO;YACL,KAAK,EAAE,IAAI,CAAC,IAAI;YAChB,iBAAiB,EAAE,IAAI,CAAC,OAAO;YAC/B,GAAG,CAAC,IAAI,CAAC,SAAS,CAAC,CAAC,CAAC,EAAE,SAAS,EAAE,IAAI,CAAC,SAAS,EAAE,CAAC,CAAC,CAAC,EAAE,CAAC;SACzD,CAAC;IACJ,CAAC;CACF"}
|
package/dist/index.d.ts
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAKA,cAAc,aAAa,CAAC;AAC5B,cAAc,aAAa,CAAC;AAC5B,cAAc,UAAU,CAAC;AACzB,cAAc,cAAc,CAAC;AAC7B,cAAc,aAAa,CAAC;AAC5B,cAAc,cAAc,CAAC;AAC7B,cAAc,YAAY,CAAC"}
|
package/dist/index.js
ADDED
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
// Copyright (C) 2026 Garudex Labs. All Rights Reserved.
|
|
2
|
+
// Caracal, a product of Garudex Labs
|
|
3
|
+
//
|
|
4
|
+
// @caracalai/core — configuration, errors, and logging for TypeScript services.
|
|
5
|
+
export * from './config.js';
|
|
6
|
+
export * from './crypto.js';
|
|
7
|
+
export * from './env.js';
|
|
8
|
+
export * from './envfile.js';
|
|
9
|
+
export * from './errors.js';
|
|
10
|
+
export * from './logging.js';
|
|
11
|
+
export * from './scope.js';
|
|
12
|
+
//# sourceMappingURL=index.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,yDAAyD;AACzD,qCAAqC;AACrC,EAAE;AACF,gFAAgF;AAEhF,cAAc,aAAa,CAAC;AAC5B,cAAc,aAAa,CAAC;AAC5B,cAAc,UAAU,CAAC;AACzB,cAAc,cAAc,CAAC;AAC7B,cAAc,aAAa,CAAC;AAC5B,cAAc,cAAc,CAAC;AAC7B,cAAc,YAAY,CAAC"}
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
type Level = 'debug' | 'info' | 'warn' | 'error';
|
|
2
|
+
export type Logger = ReturnType<typeof createLogger>;
|
|
3
|
+
export declare function createLogger(service: string, level?: Level): {
|
|
4
|
+
debug: (msg: string, fields?: Record<string, unknown>) => void;
|
|
5
|
+
info: (msg: string, fields?: Record<string, unknown>) => void;
|
|
6
|
+
warn: (msg: string, fields?: Record<string, unknown>) => void;
|
|
7
|
+
error: (msg: string, fields?: Record<string, unknown>) => void;
|
|
8
|
+
};
|
|
9
|
+
export {};
|
|
10
|
+
//# sourceMappingURL=logging.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"logging.d.ts","sourceRoot":"","sources":["../src/logging.ts"],"names":[],"mappings":"AAKA,KAAK,KAAK,GAAG,OAAO,GAAG,MAAM,GAAG,MAAM,GAAG,OAAO,CAAC;AAQjD,MAAM,MAAM,MAAM,GAAG,UAAU,CAAC,OAAO,YAAY,CAAC,CAAC;AAErD,wBAAgB,YAAY,CAAC,OAAO,EAAE,MAAM,EAAE,KAAK,GAAE,KAAc;iBASlD,MAAM,WAAW,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC;gBACzC,MAAM,WAAW,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC;gBACxC,MAAM,WAAW,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC;iBACvC,MAAM,WAAW,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC;EAExD"}
|
package/dist/logging.js
ADDED
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
// Copyright (C) 2026 Garudex Labs. All Rights Reserved.
|
|
2
|
+
// Caracal, a product of Garudex Labs
|
|
3
|
+
//
|
|
4
|
+
// Structured JSON logger for TypeScript services.
|
|
5
|
+
const ORDER = ['debug', 'info', 'warn', 'error'];
|
|
6
|
+
function shouldLog(msgLevel, configLevel) {
|
|
7
|
+
return ORDER.indexOf(msgLevel) >= ORDER.indexOf(configLevel);
|
|
8
|
+
}
|
|
9
|
+
export function createLogger(service, level = 'info') {
|
|
10
|
+
const emit = (msgLevel, msg, fields) => {
|
|
11
|
+
if (!shouldLog(msgLevel, level))
|
|
12
|
+
return;
|
|
13
|
+
process.stderr.write(JSON.stringify({ level: msgLevel, service, msg, time: new Date().toISOString(), ...fields }) +
|
|
14
|
+
'\n');
|
|
15
|
+
};
|
|
16
|
+
return {
|
|
17
|
+
debug: (msg, fields) => emit('debug', msg, fields),
|
|
18
|
+
info: (msg, fields) => emit('info', msg, fields),
|
|
19
|
+
warn: (msg, fields) => emit('warn', msg, fields),
|
|
20
|
+
error: (msg, fields) => emit('error', msg, fields),
|
|
21
|
+
};
|
|
22
|
+
}
|
|
23
|
+
//# sourceMappingURL=logging.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"logging.js","sourceRoot":"","sources":["../src/logging.ts"],"names":[],"mappings":"AAAA,yDAAyD;AACzD,qCAAqC;AACrC,EAAE;AACF,kDAAkD;AAIlD,MAAM,KAAK,GAAY,CAAC,OAAO,EAAE,MAAM,EAAE,MAAM,EAAE,OAAO,CAAC,CAAC;AAE1D,SAAS,SAAS,CAAC,QAAe,EAAE,WAAkB;IACpD,OAAO,KAAK,CAAC,OAAO,CAAC,QAAQ,CAAC,IAAI,KAAK,CAAC,OAAO,CAAC,WAAW,CAAC,CAAC;AAC/D,CAAC;AAID,MAAM,UAAU,YAAY,CAAC,OAAe,EAAE,QAAe,MAAM;IACjE,MAAM,IAAI,GAAG,CAAC,QAAe,EAAE,GAAW,EAAE,MAAgC,EAAE,EAAE;QAC9E,IAAI,CAAC,SAAS,CAAC,QAAQ,EAAE,KAAK,CAAC;YAAE,OAAO;QACxC,OAAO,CAAC,MAAM,CAAC,KAAK,CAClB,IAAI,CAAC,SAAS,CAAC,EAAE,KAAK,EAAE,QAAQ,EAAE,OAAO,EAAE,GAAG,EAAE,IAAI,EAAE,IAAI,IAAI,EAAE,CAAC,WAAW,EAAE,EAAE,GAAG,MAAM,EAAE,CAAC;YAC1F,IAAI,CACP,CAAC;IACJ,CAAC,CAAC;IACF,OAAO;QACL,KAAK,EAAE,CAAC,GAAW,EAAE,MAAgC,EAAE,EAAE,CAAC,IAAI,CAAC,OAAO,EAAE,GAAG,EAAE,MAAM,CAAC;QACpF,IAAI,EAAE,CAAC,GAAW,EAAE,MAAgC,EAAE,EAAE,CAAC,IAAI,CAAC,MAAM,EAAE,GAAG,EAAE,MAAM,CAAC;QAClF,IAAI,EAAE,CAAC,GAAW,EAAE,MAAgC,EAAE,EAAE,CAAC,IAAI,CAAC,MAAM,EAAE,GAAG,EAAE,MAAM,CAAC;QAClF,KAAK,EAAE,CAAC,GAAW,EAAE,MAAgC,EAAE,EAAE,CAAC,IAAI,CAAC,OAAO,EAAE,GAAG,EAAE,MAAM,CAAC;KACrF,CAAC;AACJ,CAAC"}
|
package/dist/scope.d.ts
ADDED
|
@@ -0,0 +1,4 @@
|
|
|
1
|
+
export declare function parseScope(scope: string | null | undefined): string[];
|
|
2
|
+
export declare function hasScope(scope: string | null | undefined, required: string): boolean;
|
|
3
|
+
export declare function scopesAllowed(requested: string[], available: string[]): boolean;
|
|
4
|
+
//# sourceMappingURL=scope.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"scope.d.ts","sourceRoot":"","sources":["../src/scope.ts"],"names":[],"mappings":"AAQA,wBAAgB,UAAU,CAAC,KAAK,EAAE,MAAM,GAAG,IAAI,GAAG,SAAS,GAAG,MAAM,EAAE,CAUrE;AAID,wBAAgB,QAAQ,CAAC,KAAK,EAAE,MAAM,GAAG,IAAI,GAAG,SAAS,EAAE,QAAQ,EAAE,MAAM,GAAG,OAAO,CAGpF;AAGD,wBAAgB,aAAa,CAAC,SAAS,EAAE,MAAM,EAAE,EAAE,SAAS,EAAE,MAAM,EAAE,GAAG,OAAO,CAG/E"}
|
package/dist/scope.js
ADDED
|
@@ -0,0 +1,33 @@
|
|
|
1
|
+
// Copyright (C) 2026 Garudex Labs. All Rights Reserved.
|
|
2
|
+
// Caracal, a product of Garudex Labs
|
|
3
|
+
//
|
|
4
|
+
// Canonical OAuth 2.0 scope-string parser shared across all TS callers.
|
|
5
|
+
// parseScope splits an OAuth 2.0 scope string per RFC 6749 §3.3: tokens are
|
|
6
|
+
// separated by ASCII whitespace and empty tokens are ignored. Returns a
|
|
7
|
+
// distinct, order-preserving array.
|
|
8
|
+
export function parseScope(scope) {
|
|
9
|
+
if (!scope)
|
|
10
|
+
return [];
|
|
11
|
+
const seen = new Set();
|
|
12
|
+
const out = [];
|
|
13
|
+
for (const token of scope.split(/\s+/)) {
|
|
14
|
+
if (token === '' || seen.has(token))
|
|
15
|
+
continue;
|
|
16
|
+
seen.add(token);
|
|
17
|
+
out.push(token);
|
|
18
|
+
}
|
|
19
|
+
return out;
|
|
20
|
+
}
|
|
21
|
+
// hasScope reports whether the parsed scope grants `required`. Empty `required`
|
|
22
|
+
// is treated as a programming error and never matches.
|
|
23
|
+
export function hasScope(scope, required) {
|
|
24
|
+
if (!required)
|
|
25
|
+
return false;
|
|
26
|
+
return parseScope(scope).includes(required);
|
|
27
|
+
}
|
|
28
|
+
// scopesAllowed reports whether every scope in `requested` is present in `available`.
|
|
29
|
+
export function scopesAllowed(requested, available) {
|
|
30
|
+
const allowed = new Set(available);
|
|
31
|
+
return requested.every((s) => allowed.has(s));
|
|
32
|
+
}
|
|
33
|
+
//# sourceMappingURL=scope.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"scope.js","sourceRoot":"","sources":["../src/scope.ts"],"names":[],"mappings":"AAAA,yDAAyD;AACzD,qCAAqC;AACrC,EAAE;AACF,wEAAwE;AAExE,4EAA4E;AAC5E,wEAAwE;AACxE,oCAAoC;AACpC,MAAM,UAAU,UAAU,CAAC,KAAgC;IACzD,IAAI,CAAC,KAAK;QAAE,OAAO,EAAE,CAAA;IACrB,MAAM,IAAI,GAAG,IAAI,GAAG,EAAU,CAAA;IAC9B,MAAM,GAAG,GAAa,EAAE,CAAA;IACxB,KAAK,MAAM,KAAK,IAAI,KAAK,CAAC,KAAK,CAAC,KAAK,CAAC,EAAE,CAAC;QACvC,IAAI,KAAK,KAAK,EAAE,IAAI,IAAI,CAAC,GAAG,CAAC,KAAK,CAAC;YAAE,SAAQ;QAC7C,IAAI,CAAC,GAAG,CAAC,KAAK,CAAC,CAAA;QACf,GAAG,CAAC,IAAI,CAAC,KAAK,CAAC,CAAA;IACjB,CAAC;IACD,OAAO,GAAG,CAAA;AACZ,CAAC;AAED,gFAAgF;AAChF,uDAAuD;AACvD,MAAM,UAAU,QAAQ,CAAC,KAAgC,EAAE,QAAgB;IACzE,IAAI,CAAC,QAAQ;QAAE,OAAO,KAAK,CAAA;IAC3B,OAAO,UAAU,CAAC,KAAK,CAAC,CAAC,QAAQ,CAAC,QAAQ,CAAC,CAAA;AAC7C,CAAC;AAED,sFAAsF;AACtF,MAAM,UAAU,aAAa,CAAC,SAAmB,EAAE,SAAmB;IACpE,MAAM,OAAO,GAAG,IAAI,GAAG,CAAC,SAAS,CAAC,CAAA;IAClC,OAAO,SAAS,CAAC,KAAK,CAAC,CAAC,CAAC,EAAE,EAAE,CAAC,OAAO,CAAC,GAAG,CAAC,CAAC,CAAC,CAAC,CAAA;AAC/C,CAAC"}
|
package/package.json
ADDED
|
@@ -0,0 +1,40 @@
|
|
|
1
|
+
{
|
|
2
|
+
"name": "@caracalai/core",
|
|
3
|
+
"version": "0.1.0",
|
|
4
|
+
"description": "Caracal SDK foundation: logging, config, errors.",
|
|
5
|
+
"license": "Apache-2.0",
|
|
6
|
+
"homepage": "https://github.com/Garudex-Labs/caracal",
|
|
7
|
+
"repository": {
|
|
8
|
+
"type": "git",
|
|
9
|
+
"url": "https://github.com/Garudex-Labs/caracal.git",
|
|
10
|
+
"directory": "packages/core/ts"
|
|
11
|
+
},
|
|
12
|
+
"keywords": ["caracal", "agent", "identity", "sdk"],
|
|
13
|
+
"type": "module",
|
|
14
|
+
"main": "./dist/index.js",
|
|
15
|
+
"types": "./dist/index.d.ts",
|
|
16
|
+
"exports": {
|
|
17
|
+
".": {
|
|
18
|
+
"import": "./dist/index.js",
|
|
19
|
+
"types": "./dist/index.d.ts"
|
|
20
|
+
},
|
|
21
|
+
"./cli": {
|
|
22
|
+
"import": "./dist/cliconfig.js",
|
|
23
|
+
"types": "./dist/cliconfig.d.ts"
|
|
24
|
+
}
|
|
25
|
+
},
|
|
26
|
+
"files": ["dist", "README.md", "LICENSE"],
|
|
27
|
+
"publishConfig": { "access": "public" },
|
|
28
|
+
"scripts": {
|
|
29
|
+
"build": "tsc",
|
|
30
|
+
"dev": "tsc --watch",
|
|
31
|
+
"typecheck": "tsc --noEmit",
|
|
32
|
+
"test": "vitest run --root ../../.. tests/typescript/unit/shared",
|
|
33
|
+
"prepublishOnly": "tsc"
|
|
34
|
+
},
|
|
35
|
+
"devDependencies": {
|
|
36
|
+
"@types/node": "^24.0.0",
|
|
37
|
+
"typescript": "^5.8.0",
|
|
38
|
+
"vitest": "^3.0.0"
|
|
39
|
+
}
|
|
40
|
+
}
|