@blogic-cz/agent-tools 1.6.19 → 1.7.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/README.md +8 -2
- package/dist/api-tool/client.d.ts +8 -0
- package/dist/api-tool/client.d.ts.map +1 -0
- package/dist/api-tool/errors.d.ts +14 -0
- package/dist/api-tool/errors.d.ts.map +1 -0
- package/dist/api-tool/index.d.ts +3 -0
- package/dist/api-tool/index.d.ts.map +1 -0
- package/dist/api-tool/main.d.ts +2 -0
- package/dist/api-tool/main.d.ts.map +1 -0
- package/dist/api-tool/proxy-entry.d.ts +3 -0
- package/dist/api-tool/proxy-entry.d.ts.map +1 -0
- package/dist/api-tool/proxy.d.ts +15 -0
- package/dist/api-tool/proxy.d.ts.map +1 -0
- package/dist/api-tool/retention.d.ts +9 -0
- package/dist/api-tool/retention.d.ts.map +1 -0
- package/dist/api-tool/server.d.ts +6 -0
- package/dist/api-tool/server.d.ts.map +1 -0
- package/dist/api-tool/store.d.ts +5 -0
- package/dist/api-tool/store.d.ts.map +1 -0
- package/dist/api-tool/transport.d.ts +26 -0
- package/dist/api-tool/transport.d.ts.map +1 -0
- package/dist/api-tool/types.d.ts +136 -0
- package/dist/api-tool/types.d.ts.map +1 -0
- package/dist/credential-guard/index.d.ts.map +1 -1
- package/dist/gh-tool/issue/core.d.ts.map +1 -1
- package/dist/gh-tool/pr/review.d.ts.map +1 -1
- package/docs/rest-api-proxy.md +136 -0
- package/package.json +16 -2
- package/src/api-tool/client.ts +56 -0
- package/src/api-tool/errors.ts +41 -0
- package/src/api-tool/index.ts +4 -0
- package/src/api-tool/main.ts +58 -0
- package/src/api-tool/proxy-entry.ts +19 -0
- package/src/api-tool/proxy.ts +298 -0
- package/src/api-tool/retention.ts +58 -0
- package/src/api-tool/server.ts +114 -0
- package/src/api-tool/store.ts +93 -0
- package/src/api-tool/transport.ts +167 -0
- package/src/api-tool/types.ts +202 -0
- package/src/credential-guard/index.ts +58 -0
- package/src/gh-tool/issue/core.ts +2 -3
- package/src/gh-tool/pr/review.ts +4 -6
package/README.md
CHANGED
|
@@ -1,6 +1,8 @@
|
|
|
1
1
|
# @blogic-cz/agent-tools
|
|
2
2
|
|
|
3
|
-
Safe CLI wrappers for AI coding agents.
|
|
3
|
+
Safe CLI wrappers for AI coding agents. Tools for GitHub, observability, databases, Kubernetes, Azure platform, Azure DevOps, logs, OpenCode sessions, audit history and generic JSON REST requests.
|
|
4
|
+
|
|
5
|
+
The [REST credential proxy](docs/rest-api-proxy.md) adds `api-tool`, an exported TypeScript client and the operator-only `api-proxy` runtime. Deploy its private credential store under a separate service identity outside agent authority, with verified TLS. Its client configuration is separate from `agent-tools.json5`.
|
|
4
6
|
|
|
5
7
|
## Why
|
|
6
8
|
|
|
@@ -273,6 +275,8 @@ approval permits exact nonsensitive reads, not script execution or environment f
|
|
|
273
275
|
| `azdo-tool` | Azure DevOps tool — pipelines, builds, repos |
|
|
274
276
|
| `logs-tool` | Application logs — read local and remote (k8s pod) logs |
|
|
275
277
|
| `session-tool` | OpenCode session browser — list, read, search sessions |
|
|
278
|
+
| `api-tool` | JSON REST client using an operator-issued capability |
|
|
279
|
+
| `api-proxy` | Isolated operator service holding upstream REST credentials |
|
|
276
280
|
|
|
277
281
|
All tools support `--help` for full usage documentation. Legacy `agent-tools-*` binary names (e.g. `agent-tools-gh`) still work for backwards compatibility.
|
|
278
282
|
|
|
@@ -534,8 +538,10 @@ Each tool uses its own auth method — no unified token store:
|
|
|
534
538
|
| `azdo-tool` | `az` CLI session (`az login`) |
|
|
535
539
|
| `db-tool` | Password from env var defined by `passwordEnvVar` in config (e.g. `AGENT_TOOLS_DB_PASSWORD`) |
|
|
536
540
|
| `logs-tool` | No auth — reads local files or uses k8s-tool for remote access |
|
|
541
|
+
| `api-tool` | Caller capability and proxy HTTPS origin in client configuration |
|
|
542
|
+
| `api-proxy` | Private operator store and policy under a separated service identity |
|
|
537
543
|
|
|
538
|
-
|
|
544
|
+
The REST proxy uses its separate private operator store described in [REST proxy setup](docs/rest-api-proxy.md). Other tool configs reference credential sources. Provider secrets are **never** stored in the caller client config file. The `db-tool` config references env var **names** only:
|
|
539
545
|
|
|
540
546
|
```json5
|
|
541
547
|
{
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
import type { ApiRequest, ApiResult, ClientConfig } from "./types";
|
|
2
|
+
import type { Transport } from "./transport";
|
|
3
|
+
export declare function createApiClient(value: ClientConfig, transport?: Transport): {
|
|
4
|
+
request: (input: ApiRequest) => Promise<ApiResult>;
|
|
5
|
+
};
|
|
6
|
+
export type { ApiRequest, ApiResult, ClientConfig } from "./types";
|
|
7
|
+
export { ApiError } from "./errors";
|
|
8
|
+
//# sourceMappingURL=client.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"client.d.ts","sourceRoot":"","sources":["../../src/api-tool/client.ts"],"names":[],"mappings":"AAQA,OAAO,KAAK,EAAE,UAAU,EAAE,SAAS,EAAE,YAAY,EAAE,MAAM,SAAS,CAAC;AAGnE,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,aAAa,CAAC;AAG7C,wBAAgB,eAAe,CAAC,KAAK,EAAE,YAAY,EAAE,SAAS,GAAE,SAA2B;IAKvF,OAAO,UAAgB,UAAU,KAAG,OAAO,CAAC,SAAS,CAAC;EAkCzD;AACD,YAAY,EAAE,UAAU,EAAE,SAAS,EAAE,YAAY,EAAE,MAAM,SAAS,CAAC;AACnE,OAAO,EAAE,QAAQ,EAAE,MAAM,UAAU,CAAC"}
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
import { Schema } from "effect";
|
|
2
|
+
export declare const ErrorCode: Schema.Literals<readonly ["CONFIG_INVALID", "CREDENTIAL_UNAVAILABLE", "UNAUTHORIZED", "POLICY_DENIED", "BUDGET_EXHAUSTED", "DESTINATION_DENIED", "UPSTREAM_FAILED", "LIMIT_EXCEEDED", "DEADLINE_EXCEEDED", "DISCLOSURE_DENIED", "GRANT_ALREADY_USED", "GRANT_STORE_UNAVAILABLE"]>;
|
|
3
|
+
declare const ApiError_base: Schema.Class<ApiError, Schema.TaggedStruct<"ApiError", {
|
|
4
|
+
readonly code: Schema.Literals<readonly ["CONFIG_INVALID", "CREDENTIAL_UNAVAILABLE", "UNAUTHORIZED", "POLICY_DENIED", "BUDGET_EXHAUSTED", "DESTINATION_DENIED", "UPSTREAM_FAILED", "LIMIT_EXCEEDED", "DEADLINE_EXCEEDED", "DISCLOSURE_DENIED", "GRANT_ALREADY_USED", "GRANT_STORE_UNAVAILABLE"]>;
|
|
5
|
+
readonly message: Schema.String;
|
|
6
|
+
readonly hint: Schema.String;
|
|
7
|
+
}>, import("effect/Cause").YieldableError>;
|
|
8
|
+
export declare class ApiError extends ApiError_base {
|
|
9
|
+
}
|
|
10
|
+
export type ErrorCode = typeof ErrorCode.Type;
|
|
11
|
+
export declare const apiError: (code: ErrorCode) => ApiError;
|
|
12
|
+
export declare const safeError: (error: unknown) => ApiError;
|
|
13
|
+
export {};
|
|
14
|
+
//# sourceMappingURL=errors.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"errors.d.ts","sourceRoot":"","sources":["../../src/api-tool/errors.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,MAAM,EAAE,MAAM,QAAQ,CAAC;AAEhC,eAAO,MAAM,SAAS,mRAapB,CAAC;;;;;;AACH,qBAAa,QAAS,SAAQ,aAI5B;CAAG;AACL,MAAM,MAAM,SAAS,GAAG,OAAO,SAAS,CAAC,IAAI,CAAC;AAgB9C,eAAO,MAAM,QAAQ,SAAU,SAAS,KAAG,QACe,CAAC;AAC3D,eAAO,MAAM,SAAS,UAAW,OAAO,KAAG,QACqC,CAAC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/api-tool/index.ts"],"names":[],"mappings":""}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"main.d.ts","sourceRoot":"","sources":["../../src/api-tool/main.ts"],"names":[],"mappings":""}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"proxy-entry.d.ts","sourceRoot":"","sources":["../../src/api-tool/proxy-entry.ts"],"names":[],"mappings":""}
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
import type { ApiResult } from "./types";
|
|
2
|
+
import type { Transport } from "./transport";
|
|
3
|
+
export declare const capabilityDigest: (capability: string) => string;
|
|
4
|
+
export declare function createProxy(options: {
|
|
5
|
+
config: unknown;
|
|
6
|
+
secrets: Readonly<Record<string, string>>;
|
|
7
|
+
transport: Transport;
|
|
8
|
+
now?: () => number;
|
|
9
|
+
}): {
|
|
10
|
+
authorize: (capability: string) => void;
|
|
11
|
+
revoke: (digest: string) => void;
|
|
12
|
+
request: (capability: string, input: unknown) => Promise<ApiResult>;
|
|
13
|
+
requestSerialized: (capability: string, input: unknown) => Promise<string>;
|
|
14
|
+
};
|
|
15
|
+
//# sourceMappingURL=proxy.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"proxy.d.ts","sourceRoot":"","sources":["../../src/api-tool/proxy.ts"],"names":[],"mappings":"AAYA,OAAO,KAAK,EAAE,SAAS,EAAkB,MAAM,SAAS,CAAC;AAGzD,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,aAAa,CAAC;AAE7C,eAAO,MAAM,gBAAgB,eAAgB,MAAM,KAAG,MACC,CAAC;AASxD,wBAAgB,WAAW,CAAC,OAAO,EAAE;IACnC,MAAM,EAAE,OAAO,CAAC;IAChB,OAAO,EAAE,QAAQ,CAAC,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,CAAC,CAAC;IAC1C,SAAS,EAAE,SAAS,CAAC;IACrB,GAAG,CAAC,EAAE,MAAM,MAAM,CAAC;CACpB;IA6PG,SAAS,eAAe,MAAM,KAAG,IAAI;IAGrC,MAAM,WAAW,MAAM,KAAG,IAAI;IAI9B,OAAO,eAAqB,MAAM,SAAS,OAAO,KAAG,OAAO,CAAC,SAAS,CAAC;IAEvE,iBAAiB,eAAqB,MAAM,SAAS,OAAO,KAAG,OAAO,CAAC,MAAM,CAAC;EAGjF"}
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
export declare const MAX_RETAINED_CREDENTIALS = 128;
|
|
2
|
+
export declare function createCredentialRetention(initial: readonly string[]): {
|
|
3
|
+
protects: (serialized: string) => boolean;
|
|
4
|
+
reserve: () => {
|
|
5
|
+
release: () => void;
|
|
6
|
+
retain: (value: string) => void;
|
|
7
|
+
};
|
|
8
|
+
};
|
|
9
|
+
//# sourceMappingURL=retention.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"retention.d.ts","sourceRoot":"","sources":["../../src/api-tool/retention.ts"],"names":[],"mappings":"AAEA,eAAO,MAAM,wBAAwB,MAAM,CAAC;AAK5C,wBAAgB,yBAAyB,CAAC,OAAO,EAAE,SAAS,MAAM,EAAE;2BAoBzC,MAAM,KAAG,OAAO;;uBAcjB,IAAI;wBAQN,MAAM,KAAG,IAAI;;EAQpC"}
|
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
import type { IncomingMessage, ServerResponse } from "node:http";
|
|
2
|
+
import { createProxy } from "./proxy";
|
|
3
|
+
import type { Transport } from "./transport";
|
|
4
|
+
export declare function createRequestHandler(proxy: ReturnType<typeof createProxy>, maxConcurrent: number): (request: IncomingMessage, response: ServerResponse) => void;
|
|
5
|
+
export declare function startProxy(configValue: unknown, transport?: Transport): Promise<import("node:http").Server<typeof IncomingMessage, typeof ServerResponse>>;
|
|
6
|
+
//# sourceMappingURL=server.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"server.d.ts","sourceRoot":"","sources":["../../src/api-tool/server.ts"],"names":[],"mappings":"AAEA,OAAO,KAAK,EAAE,eAAe,EAAE,cAAc,EAAE,MAAM,WAAW,CAAC;AACjE,OAAO,EAAE,WAAW,EAAE,MAAM,SAAS,CAAC;AAEtC,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,aAAa,CAAC;AAM7C,wBAAgB,oBAAoB,CAAC,KAAK,EAAE,UAAU,CAAC,OAAO,WAAW,CAAC,EAAE,aAAa,EAAE,MAAM,aAE9E,eAAe,YAAY,cAAc,KAAG,IAAI,CAiElE;AAED,wBAAsB,UAAU,CAAC,WAAW,EAAE,OAAO,EAAE,SAAS,GAAE,SAA2B,sFAiC5F"}
|
|
@@ -0,0 +1,5 @@
|
|
|
1
|
+
import type { OperatorConfig } from "./types";
|
|
2
|
+
export declare function readPrivateFile(path: string): Promise<string>;
|
|
3
|
+
export declare function readSecretStore(path: string): Promise<Readonly<Record<string, string>>>;
|
|
4
|
+
export declare function claimGrants(config: OperatorConfig): Promise<void>;
|
|
5
|
+
//# sourceMappingURL=store.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"store.d.ts","sourceRoot":"","sources":["../../src/api-tool/store.ts"],"names":[],"mappings":"AAMA,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,SAAS,CAAC;AAS9C,wBAAsB,eAAe,CAAC,IAAI,EAAE,MAAM,GAAG,OAAO,CAAC,MAAM,CAAC,CAoBnE;AACD,wBAAsB,eAAe,CAAC,IAAI,EAAE,MAAM,GAAG,OAAO,CAAC,QAAQ,CAAC,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,CAAC,CAAC,CAqB7F;AACD,wBAAsB,WAAW,CAAC,MAAM,EAAE,cAAc,GAAG,OAAO,CAAC,IAAI,CAAC,CAkCvE"}
|
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
import type { SecureContextOptions } from "node:tls";
|
|
2
|
+
export type TransportRequest = {
|
|
3
|
+
url: URL;
|
|
4
|
+
method: string;
|
|
5
|
+
headers: Readonly<Record<string, string>>;
|
|
6
|
+
body: string;
|
|
7
|
+
maxBytes: number;
|
|
8
|
+
signal: AbortSignal;
|
|
9
|
+
allowedPrivateAddresses: readonly string[];
|
|
10
|
+
developmentLoopback?: boolean;
|
|
11
|
+
};
|
|
12
|
+
export type TransportResult = {
|
|
13
|
+
status: number;
|
|
14
|
+
body: string;
|
|
15
|
+
};
|
|
16
|
+
export type Transport = (request: TransportRequest) => Promise<TransportResult>;
|
|
17
|
+
export type Resolver = (host: string) => Promise<readonly {
|
|
18
|
+
address: string;
|
|
19
|
+
family: number;
|
|
20
|
+
}[]>;
|
|
21
|
+
export declare function beforeAbort<T>(operation: Promise<T>, signal: AbortSignal): Promise<T>;
|
|
22
|
+
export declare function allowedAddress(address: string, privateAllow: readonly string[], developmentLoopback?: boolean): boolean;
|
|
23
|
+
export declare const MAX_PENDING_DNS_LOOKUPS = 64;
|
|
24
|
+
export declare function makePinnedTransport(resolve?: Resolver, trust?: Pick<SecureContextOptions, "ca">): Transport;
|
|
25
|
+
export declare const pinnedTransport: Transport;
|
|
26
|
+
//# sourceMappingURL=transport.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"transport.d.ts","sourceRoot":"","sources":["../../src/api-tool/transport.ts"],"names":[],"mappings":"AAGA,OAAO,KAAK,EAAE,oBAAoB,EAAE,MAAM,UAAU,CAAC;AAIrD,MAAM,MAAM,gBAAgB,GAAG;IAC7B,GAAG,EAAE,GAAG,CAAC;IACT,MAAM,EAAE,MAAM,CAAC;IACf,OAAO,EAAE,QAAQ,CAAC,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,CAAC,CAAC;IAC1C,IAAI,EAAE,MAAM,CAAC;IACb,QAAQ,EAAE,MAAM,CAAC;IACjB,MAAM,EAAE,WAAW,CAAC;IACpB,uBAAuB,EAAE,SAAS,MAAM,EAAE,CAAC;IAC3C,mBAAmB,CAAC,EAAE,OAAO,CAAC;CAC/B,CAAC;AACF,MAAM,MAAM,eAAe,GAAG;IAAE,MAAM,EAAE,MAAM,CAAC;IAAC,IAAI,EAAE,MAAM,CAAA;CAAE,CAAC;AAC/D,MAAM,MAAM,SAAS,GAAG,CAAC,OAAO,EAAE,gBAAgB,KAAK,OAAO,CAAC,eAAe,CAAC,CAAC;AAChF,MAAM,MAAM,QAAQ,GAAG,CAAC,IAAI,EAAE,MAAM,KAAK,OAAO,CAAC,SAAS;IAAE,OAAO,EAAE,MAAM,CAAC;IAAC,MAAM,EAAE,MAAM,CAAA;CAAE,EAAE,CAAC,CAAC;AAEjG,wBAAgB,WAAW,CAAC,CAAC,EAAE,SAAS,EAAE,OAAO,CAAC,CAAC,CAAC,EAAE,MAAM,EAAE,WAAW,GAAG,OAAO,CAAC,CAAC,CAAC,CAmBrF;AAED,wBAAgB,cAAc,CAC5B,OAAO,EAAE,MAAM,EACf,YAAY,EAAE,SAAS,MAAM,EAAE,EAC/B,mBAAmB,UAAQ,GAC1B,OAAO,CAmCT;AAED,eAAO,MAAM,uBAAuB,KAAK,CAAC;AAC1C,wBAAgB,mBAAmB,CACjC,OAAO,GAAE,QAAgE,EACzE,KAAK,GAAE,IAAI,CAAC,oBAAoB,EAAE,IAAI,CAAM,GAC3C,SAAS,CA8EX;AACD,eAAO,MAAM,eAAe,WAAwB,CAAC"}
|
|
@@ -0,0 +1,136 @@
|
|
|
1
|
+
import { Schema } from "effect";
|
|
2
|
+
export declare const Method: Schema.Literals<readonly ["GET", "POST", "PUT", "PATCH", "DELETE"]>;
|
|
3
|
+
export declare const ProfileSchema: Schema.Struct<{
|
|
4
|
+
readonly origin: Schema.String;
|
|
5
|
+
readonly auth: Schema.Union<readonly [Schema.Struct<{
|
|
6
|
+
readonly kind: Schema.Literal<"bearer">;
|
|
7
|
+
readonly secretRef: Schema.String;
|
|
8
|
+
}>, Schema.Struct<{
|
|
9
|
+
readonly kind: Schema.Literal<"apiKey">;
|
|
10
|
+
readonly header: Schema.String;
|
|
11
|
+
readonly secretRef: Schema.String;
|
|
12
|
+
}>, Schema.Struct<{
|
|
13
|
+
readonly kind: Schema.Literal<"basic">;
|
|
14
|
+
readonly usernameRef: Schema.String;
|
|
15
|
+
readonly passwordRef: Schema.String;
|
|
16
|
+
}>, Schema.Struct<{
|
|
17
|
+
readonly kind: Schema.Literal<"login">;
|
|
18
|
+
readonly path: Schema.String;
|
|
19
|
+
readonly fields: Schema.$Record<Schema.String, Schema.String>;
|
|
20
|
+
readonly tokenField: Schema.String;
|
|
21
|
+
}>]>;
|
|
22
|
+
readonly methods: Schema.optionalKey<Schema.$Array<Schema.Literals<readonly ["GET", "POST", "PUT", "PATCH", "DELETE"]>>>;
|
|
23
|
+
readonly pathPrefixes: Schema.$Array<Schema.String>;
|
|
24
|
+
readonly deniedPathPrefixes: Schema.$Array<Schema.String>;
|
|
25
|
+
readonly allowedPrivateAddresses: Schema.$Array<Schema.String>;
|
|
26
|
+
readonly disclosure: Schema.Union<readonly [Schema.Struct<{
|
|
27
|
+
readonly kind: Schema.Literal<"raw">;
|
|
28
|
+
}>, Schema.Struct<{
|
|
29
|
+
readonly kind: Schema.Literal<"fields">;
|
|
30
|
+
readonly fields: Schema.$Array<Schema.String>;
|
|
31
|
+
}>]>;
|
|
32
|
+
readonly maxRequestBytes: Schema.Number;
|
|
33
|
+
readonly maxResponseBytes: Schema.Number;
|
|
34
|
+
readonly timeoutMs: Schema.Number;
|
|
35
|
+
}>;
|
|
36
|
+
declare const GrantSchema: Schema.Struct<{
|
|
37
|
+
readonly digest: Schema.String;
|
|
38
|
+
readonly expiresAt: Schema.Number;
|
|
39
|
+
readonly revoked: Schema.Boolean;
|
|
40
|
+
readonly profiles: Schema.$Array<Schema.String>;
|
|
41
|
+
readonly maxRequests: Schema.Number;
|
|
42
|
+
readonly maxBytes: Schema.Number;
|
|
43
|
+
readonly maxConcurrent: Schema.Number;
|
|
44
|
+
readonly lifetimeMs: Schema.Number;
|
|
45
|
+
}>;
|
|
46
|
+
export declare const OperatorSchema: Schema.Struct<{
|
|
47
|
+
readonly listen: Schema.Union<readonly [Schema.Struct<{
|
|
48
|
+
readonly kind: Schema.Literal<"tls">;
|
|
49
|
+
readonly host: Schema.String;
|
|
50
|
+
readonly port: Schema.Number;
|
|
51
|
+
readonly certFile: Schema.String;
|
|
52
|
+
readonly keyFile: Schema.String;
|
|
53
|
+
readonly separateIdentityAcknowledged: Schema.Literal<true>;
|
|
54
|
+
}>, Schema.Struct<{
|
|
55
|
+
readonly kind: Schema.Literal<"developmentLoopback">;
|
|
56
|
+
readonly host: Schema.Literal<"127.0.0.1">;
|
|
57
|
+
readonly port: Schema.Number;
|
|
58
|
+
}>]>;
|
|
59
|
+
readonly secretsFile: Schema.String;
|
|
60
|
+
readonly grantUseDirectory: Schema.String;
|
|
61
|
+
readonly profiles: Schema.$Record<Schema.String, Schema.Struct<{
|
|
62
|
+
readonly origin: Schema.String;
|
|
63
|
+
readonly auth: Schema.Union<readonly [Schema.Struct<{
|
|
64
|
+
readonly kind: Schema.Literal<"bearer">;
|
|
65
|
+
readonly secretRef: Schema.String;
|
|
66
|
+
}>, Schema.Struct<{
|
|
67
|
+
readonly kind: Schema.Literal<"apiKey">;
|
|
68
|
+
readonly header: Schema.String;
|
|
69
|
+
readonly secretRef: Schema.String;
|
|
70
|
+
}>, Schema.Struct<{
|
|
71
|
+
readonly kind: Schema.Literal<"basic">;
|
|
72
|
+
readonly usernameRef: Schema.String;
|
|
73
|
+
readonly passwordRef: Schema.String;
|
|
74
|
+
}>, Schema.Struct<{
|
|
75
|
+
readonly kind: Schema.Literal<"login">;
|
|
76
|
+
readonly path: Schema.String;
|
|
77
|
+
readonly fields: Schema.$Record<Schema.String, Schema.String>;
|
|
78
|
+
readonly tokenField: Schema.String;
|
|
79
|
+
}>]>;
|
|
80
|
+
readonly methods: Schema.optionalKey<Schema.$Array<Schema.Literals<readonly ["GET", "POST", "PUT", "PATCH", "DELETE"]>>>;
|
|
81
|
+
readonly pathPrefixes: Schema.$Array<Schema.String>;
|
|
82
|
+
readonly deniedPathPrefixes: Schema.$Array<Schema.String>;
|
|
83
|
+
readonly allowedPrivateAddresses: Schema.$Array<Schema.String>;
|
|
84
|
+
readonly disclosure: Schema.Union<readonly [Schema.Struct<{
|
|
85
|
+
readonly kind: Schema.Literal<"raw">;
|
|
86
|
+
}>, Schema.Struct<{
|
|
87
|
+
readonly kind: Schema.Literal<"fields">;
|
|
88
|
+
readonly fields: Schema.$Array<Schema.String>;
|
|
89
|
+
}>]>;
|
|
90
|
+
readonly maxRequestBytes: Schema.Number;
|
|
91
|
+
readonly maxResponseBytes: Schema.Number;
|
|
92
|
+
readonly timeoutMs: Schema.Number;
|
|
93
|
+
}>>;
|
|
94
|
+
readonly grants: Schema.$Array<Schema.Struct<{
|
|
95
|
+
readonly digest: Schema.String;
|
|
96
|
+
readonly expiresAt: Schema.Number;
|
|
97
|
+
readonly revoked: Schema.Boolean;
|
|
98
|
+
readonly profiles: Schema.$Array<Schema.String>;
|
|
99
|
+
readonly maxRequests: Schema.Number;
|
|
100
|
+
readonly maxBytes: Schema.Number;
|
|
101
|
+
readonly maxConcurrent: Schema.Number;
|
|
102
|
+
readonly lifetimeMs: Schema.Number;
|
|
103
|
+
}>>;
|
|
104
|
+
readonly maxConcurrent: Schema.Number;
|
|
105
|
+
}>;
|
|
106
|
+
export declare const ClientSchema: Schema.Struct<{
|
|
107
|
+
readonly proxyOrigin: Schema.String;
|
|
108
|
+
readonly capability: Schema.String;
|
|
109
|
+
readonly developmentLoopback: Schema.optionalKey<Schema.Boolean>;
|
|
110
|
+
}>;
|
|
111
|
+
export declare const RequestSchema: Schema.Struct<{
|
|
112
|
+
readonly profile: Schema.String;
|
|
113
|
+
readonly method: Schema.Literals<readonly ["GET", "POST", "PUT", "PATCH", "DELETE"]>;
|
|
114
|
+
readonly path: Schema.String;
|
|
115
|
+
readonly query: Schema.optionalKey<Schema.$Record<Schema.String, Schema.String>>;
|
|
116
|
+
readonly body: Schema.optionalKey<Schema.Codec<Schema.Json, Schema.Json, never, never>>;
|
|
117
|
+
}>;
|
|
118
|
+
export declare const ResultSchema: Schema.Struct<{
|
|
119
|
+
readonly status: Schema.Number;
|
|
120
|
+
readonly data: Schema.Codec<Schema.Json, Schema.Json, never, never>;
|
|
121
|
+
}>;
|
|
122
|
+
export type OperatorConfig = typeof OperatorSchema.Type;
|
|
123
|
+
export type ClientConfig = typeof ClientSchema.Type;
|
|
124
|
+
export type ApiRequest = typeof RequestSchema.Type;
|
|
125
|
+
export type ApiResult = typeof ResultSchema.Type;
|
|
126
|
+
export type Profile = typeof ProfileSchema.Type;
|
|
127
|
+
export type Grant = typeof GrantSchema.Type;
|
|
128
|
+
export declare function decode<S extends Schema.ConstraintDecoder<unknown>>(schema: S, value: unknown): S["Type"];
|
|
129
|
+
export declare const MAX_PATH_BYTES = 16384;
|
|
130
|
+
export declare const MAX_RESULT_ENVELOPE_BYTES = 10000000;
|
|
131
|
+
export declare function relativePath(path: string): string;
|
|
132
|
+
export declare const matchesPrefix: (path: string, prefix: string) => boolean;
|
|
133
|
+
export declare function originUrl(origin: string, developmentLoopback?: boolean): URL;
|
|
134
|
+
export declare function validateOperator(value: unknown): OperatorConfig;
|
|
135
|
+
export {};
|
|
136
|
+
//# sourceMappingURL=types.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../../src/api-tool/types.ts"],"names":[],"mappings":"AAEA,OAAO,EAAE,MAAM,EAAE,MAAM,QAAQ,CAAC;AAGhC,eAAO,MAAM,MAAM,qEAA6D,CAAC;AAoBjF,eAAO,MAAM,aAAa;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;EAcxB,CAAC;AACH,QAAA,MAAM,WAAW;;;;;;;;;EASf,CAAC;AACH,eAAO,MAAM,cAAc;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;EAqBzB,CAAC;AACH,eAAO,MAAM,YAAY;;;;EAIvB,CAAC;AACH,eAAO,MAAM,aAAa;;;;;;EAMxB,CAAC;AACH,eAAO,MAAM,YAAY;;;EAA8D,CAAC;AACxF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,eAAO,MAAM,mBAAmB;;;;gDAyM9B,CAAC;AAeH,eAAO,MAAM,sBAAsB;;;;gDA8CjC,CAAC"}
|
|
@@ -0,0 +1,136 @@
|
|
|
1
|
+
# REST credential proxy
|
|
2
|
+
|
|
3
|
+
`api-tool` and the exported TypeScript client submit JSON REST requests to an operator-owned proxy. The proxy loads provider credentials, authenticates against a fixed HTTPS origin, and returns approved JSON. It runs no uploaded scripts. Profiles configure services without adding endpoint-specific wrapper code.
|
|
4
|
+
|
|
5
|
+
## Required deployment boundary
|
|
6
|
+
|
|
7
|
+
Deploy the proxy under a separate Unix service identity or on a remote host. The requesting agent must have no access to that identity's files, process memory, administrative controls, service configuration, grant-use markers or upstream credential sources. Remove or isolate any old provider credentials in the agent's shell exports, startup files and accessible stores. The `separateIdentityAcknowledged` configuration field records operator acknowledgment. The application cannot prove OS isolation.
|
|
8
|
+
|
|
9
|
+
Production clients use verified TLS. The runtime serves TLS directly. It refuses external plaintext HTTP; explicit `developmentLoopback` binds only `127.0.0.1` and protects against accidental output only. A daemon under the same user does not prevent that user reading its credentials. Unix ownership and permissions are required by this first version's private-file backend. Windows operators can use a remote Unix proxy; no Windows store backend is implemented.
|
|
10
|
+
|
|
11
|
+
The private store is plaintext operator configuration, protected by OS ownership and permissions. It is not an encrypted vault. No provider secret belongs in client configuration, command arguments, client environment or agent-readable files.
|
|
12
|
+
|
|
13
|
+
## Operator setup
|
|
14
|
+
|
|
15
|
+
Run these steps as the isolated service owner, outside the agent's authority. Create an absolute canonical private directory with mode `0700`, and keep every configuration, private store, TLS key and certificate file mode `0600` and owned by that identity. Use a trusted operator editor or provisioning system to write the files. The runtime checks the immediate private parent directory and rejects direct symlink files, other ownership, public file permissions, missing credentials and malformed configuration. Ancestor ownership, symlinks and replacement races are operator responsibilities; these checks do not certify a whole path against an administrator. Files are limited to 1 MB.
|
|
16
|
+
|
|
17
|
+
Provision a cryptographically random caller capability with at least 32 URL-safe characters, for example through the operator's existing secret generator. Give the caller only the capability and the proxy HTTPS origin. Compute its SHA-256 digest with standard tooling and put only the digest in the operator grant. The capability authorizes allowed use; it is not an upstream credential. It must be kept private from other callers.
|
|
18
|
+
|
|
19
|
+
Create a private `grant-use` directory with mode `0700`. Before listening, the runtime exclusively creates and fsyncs a marker for every configured grant digest, then fsyncs the directory. A marker means that grant can never be used by another runtime. Restart, a crash, or partial startup requires issuing fresh capabilities and digests. Never delete or reuse markers, restore stale marker backups, or share grants across multiple proxy instances. Grant-store errors refuse startup. File and directory fsync establish the available filesystem flush contract, not universal power-loss durability. This backend does not use macOS F_FULLFSYNC. After uncertain power loss, filesystem rollback or backup restoration, provision fresh capabilities and retain existing markers before starting; never trust an absent marker as evidence an old grant is fresh. Failed startup can burn some grants. This deliberately small first version has no persistent request ledger, automatic retries, token refresh cache or automatic pagination.
|
|
20
|
+
|
|
21
|
+
Example private store, entered by the operator:
|
|
22
|
+
|
|
23
|
+
```json
|
|
24
|
+
{ "sample-token": "OPERATOR_PROVISIONS_PROVIDER_SECRET" }
|
|
25
|
+
```
|
|
26
|
+
|
|
27
|
+
Example operator configuration. Replace the digest, expiry, paths and service policy before use. The sample expiry is illustrative and must be a future epoch timestamp in milliseconds.
|
|
28
|
+
|
|
29
|
+
```json
|
|
30
|
+
{
|
|
31
|
+
"listen": {
|
|
32
|
+
"kind": "tls",
|
|
33
|
+
"host": "0.0.0.0",
|
|
34
|
+
"port": 8443,
|
|
35
|
+
"certFile": "/operator/private/cert.pem",
|
|
36
|
+
"keyFile": "/operator/private/key.pem",
|
|
37
|
+
"separateIdentityAcknowledged": true
|
|
38
|
+
},
|
|
39
|
+
"secretsFile": "/operator/private/store.json",
|
|
40
|
+
"grantUseDirectory": "/operator/private/grant-use",
|
|
41
|
+
"maxConcurrent": 4,
|
|
42
|
+
"profiles": {
|
|
43
|
+
"sample": {
|
|
44
|
+
"origin": "https://service.example.invalid",
|
|
45
|
+
"auth": { "kind": "bearer", "secretRef": "sample-token" },
|
|
46
|
+
"pathPrefixes": ["/v1"],
|
|
47
|
+
"deniedPathPrefixes": ["/v1/auth"],
|
|
48
|
+
"allowedPrivateAddresses": [],
|
|
49
|
+
"disclosure": { "kind": "fields", "fields": ["items", "total"] },
|
|
50
|
+
"maxRequestBytes": 10000,
|
|
51
|
+
"maxResponseBytes": 100000,
|
|
52
|
+
"timeoutMs": 10000
|
|
53
|
+
}
|
|
54
|
+
},
|
|
55
|
+
"grants": [
|
|
56
|
+
{
|
|
57
|
+
"digest": "OPERATOR_SUPPLIES_64_LOWERCASE_HEX_DIGEST",
|
|
58
|
+
"expiresAt": 1799999999000,
|
|
59
|
+
"revoked": false,
|
|
60
|
+
"profiles": ["sample"],
|
|
61
|
+
"maxRequests": 20,
|
|
62
|
+
"maxBytes": 2200000,
|
|
63
|
+
"maxConcurrent": 2,
|
|
64
|
+
"lifetimeMs": 600000
|
|
65
|
+
}
|
|
66
|
+
]
|
|
67
|
+
}
|
|
68
|
+
```
|
|
69
|
+
|
|
70
|
+
Start the service using its service manager and identity:
|
|
71
|
+
|
|
72
|
+
```sh
|
|
73
|
+
api-proxy --config /operator/private/operator.json
|
|
74
|
+
```
|
|
75
|
+
|
|
76
|
+
For development with synthetic credentials only, use `"listen": { "kind": "developmentLoopback", "host": "127.0.0.1", "port": 8443 }`. The client must separately enable `developmentLoopback: true`. Upstream profiles still require HTTPS.
|
|
77
|
+
|
|
78
|
+
Rotate credentials by replacing the private store through operator provisioning and restarting with fresh grants. Revoke grants by stopping the service and restarting with fresh grants for callers who retain access. Configuration is immutable during a runtime. There is no caller-facing administration endpoint. Operator code embedding the engine can call its `revoke(digest)` method. An already dispatched provider request may finish, but its result is refused after revocation; a login cannot dispatch the subsequent API operation after revocation or expiry.
|
|
79
|
+
|
|
80
|
+
## Client usage
|
|
81
|
+
|
|
82
|
+
Client configuration contains only the proxy origin and caller capability:
|
|
83
|
+
|
|
84
|
+
```json
|
|
85
|
+
{
|
|
86
|
+
"proxyOrigin": "https://proxy.example.invalid:8443",
|
|
87
|
+
"capability": "OPERATOR_ISSUES_RANDOM_CALLER_CAPABILITY"
|
|
88
|
+
}
|
|
89
|
+
```
|
|
90
|
+
|
|
91
|
+
```sh
|
|
92
|
+
api-tool request --config ./api-client.json --profile sample --path /v1/items
|
|
93
|
+
api-tool request --config ./api-client.json --profile sample --path /v1/items --query '{"limit":"10"}'
|
|
94
|
+
api-tool request --config ./api-client.json --profile sample --method POST --path /v1/search --body '{"name":"example"}'
|
|
95
|
+
api-tool request --help
|
|
96
|
+
bun run api-tool request --config ./api-client.json --profile sample --path /v1/items
|
|
97
|
+
```
|
|
98
|
+
|
|
99
|
+
GET is the default policy when `methods` is absent. An operator can explicitly approve `GET`, `POST`, `PUT`, `PATCH`, `DELETE`. GET itself is not evidence that an endpoint has no side effects. The operator approves service semantics and uses provider-side least privilege.
|
|
100
|
+
|
|
101
|
+
```ts
|
|
102
|
+
import { createApiClient } from "@blogic-cz/agent-tools/api";
|
|
103
|
+
|
|
104
|
+
const api = createApiClient(clientConfig);
|
|
105
|
+
const result = await api.request({
|
|
106
|
+
profile: "sample",
|
|
107
|
+
method: "GET",
|
|
108
|
+
path: "/v1/items",
|
|
109
|
+
query: { limit: "10" },
|
|
110
|
+
});
|
|
111
|
+
```
|
|
112
|
+
|
|
113
|
+
`ApiError` has stable `code`, `message` and safe `hint` fields. Provider bodies, headers, URLs, tokens and underlying exception details never become public errors. Client requests cannot change targets, headers, credentials, methods policy or disclosure rules. Successful responses with an empty body return `data: null`, including 204/205 responses, without retrying the provider operation. The CLI prints JSON and does not add requests or response data to the existing audit log.
|
|
114
|
+
|
|
115
|
+
## Authentication and disclosure
|
|
116
|
+
|
|
117
|
+
Supported profile auth shapes:
|
|
118
|
+
|
|
119
|
+
```json
|
|
120
|
+
{ "kind": "bearer", "secretRef": "token" }
|
|
121
|
+
{ "kind": "apiKey", "header": "x-api-key", "secretRef": "api-key" }
|
|
122
|
+
{ "kind": "basic", "usernameRef": "username", "passwordRef": "password" }
|
|
123
|
+
{ "kind": "login", "path": "/auth/login", "fields": { "username": "username", "password": "password" }, "tokenField": "access_token" }
|
|
124
|
+
```
|
|
125
|
+
|
|
126
|
+
Login is one configured JSON POST at the exact profile origin. Its fixed fields reference the private store. The response's configured top-level string token becomes a Bearer header inside the proxy. Login output never goes to callers, and the login path and descendants are denied to client requests. Login and API requests share a single deadline; the budget reserves both requests' maximum bytes. Failed login refuses the operation. Unsupported cookie, OAuth browser, multipart and executable authentication flows refuse configuration instead of executing custom code.
|
|
127
|
+
|
|
128
|
+
Choose `disclosure: { "kind": "fields", "fields": [...] }` to project top-level object fields. Choose `disclosure: { "kind": "raw" }` only when the operator authorizes the service's complete JSON response. Neither mode promises that application data are nonsensitive. Exact stored-secret and minted-token echoes, including JSON-escaped, URI-component, form URL-encoded and base64 variants, refuse disclosure. URL percent escapes match without regard to their hexadecimal letter case; credential letters remain case-sensitive. This does not detect arbitrary transformed secrets or establish universal privacy. At most 128 distinct stored secrets, deterministic Basic credentials and retained auth tokens are allowed per runtime. Pending logins reserve retention slots before dispatch, and reaching the retention bound refuses new logins. Failed exchanges release their slots; a token already known releases its extra reservation without evicting any credential. An aborted exchange keeps its slot until the transport settles, and any valid token it returns is retained before the operation can continue. Tokens are never evicted from echo checks.
|
|
129
|
+
|
|
130
|
+
## Transport and budgets
|
|
131
|
+
|
|
132
|
+
The proxy permits only the exact configured HTTPS origin and strict relative paths. It refuses all percent-encoded paths, traversal, semicolons, segments ending with a dot, double slash, query/fragment embedded in paths and absolute URLs. Supply query strings through the `query` object. Prefix checks respect path segment boundaries. Denied and login paths also match without case distinctions to protect services that normalize case. Configure denied auth paths for services with other authentication endpoints.
|
|
133
|
+
|
|
134
|
+
The transport ignores ambient HTTP proxy variables, creates direct connections, never follows redirects, resolves every DNS answer, refuses unknown/mixed forbidden addresses, and pins the actual socket lookup to a checked address while retaining TLS hostname verification. Private addresses require an exact normalized IP allowance; link-local/cloud metadata and mapped IPv6 addresses are always refused. The public-address classifier is conservative, so some special-use addresses are refused. The public client currently supports a publicly addressed HTTPS proxy or explicit loopback development; it has no private-proxy IP allowance.
|
|
135
|
+
|
|
136
|
+
Admission synchronously checks cumulative requests, reserved bytes, concurrency, grant expiry and runtime lifetime before I/O. The runtime never refunds failed requests or unused byte reservations. There are finite per-request streamed response and input limits, DNS/request deadlines and server connection limits. At most 64 unresolved DNS operations remain outstanding per trusted transport instance; aborted lookups retain those slots until they settle. Unknown, revoked, expired and lifetime-exhausted capabilities refuse before reading request bodies. Connection and network saturation still require deployment controls. The configuration caps profiles/grants at 100, requests at 10000 per grant, concurrency at 64, request JSON at 1 MB, response JSON at 10 MB, serialized result envelopes at 10 MB, paths at 16,384 ASCII bytes, per-request time at 60 seconds and grant runtime lifetime at 24 hours. Callers implement bounded loops themselves and never pass provider pagination URLs as targets. The 10 MB serialized result-envelope limit includes status and JSON wrapping and is separate from the configured upstream response-body limit. JSON numbers may expand during serialization; a response exceeding the envelope limit refuses with `LIMIT_EXCEEDED` before output. Server request envelopes and network protocol overhead are separately bounded; grant byte accounting covers configured provider payload/path maxima, not total TCP/TLS wire bytes.
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@blogic-cz/agent-tools",
|
|
3
|
-
"version": "1.
|
|
3
|
+
"version": "1.7.0",
|
|
4
4
|
"description": "CLI tools for AI coding agent workflows — GitHub, database, Kubernetes, Azure platform, Azure DevOps, logs, sessions, and audit",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"agent",
|
|
@@ -20,6 +20,7 @@
|
|
|
20
20
|
"url": "https://github.com/blogic-cz/agent-tools.git"
|
|
21
21
|
},
|
|
22
22
|
"bin": {
|
|
23
|
+
"agent-tools-api": "./src/api-tool/index.ts",
|
|
23
24
|
"agent-tools-audit": "./src/audit-tool/index.ts",
|
|
24
25
|
"agent-tools-az": "./src/az-tool/index.ts",
|
|
25
26
|
"agent-tools-azdo": "./src/azdo-tool/index.ts",
|
|
@@ -29,6 +30,8 @@
|
|
|
29
30
|
"agent-tools-logs": "./src/logs-tool/index.ts",
|
|
30
31
|
"agent-tools-observability": "./src/observability-tool/index.ts",
|
|
31
32
|
"agent-tools-session": "./src/session-tool/index.ts",
|
|
33
|
+
"api-proxy": "./src/api-tool/proxy-entry.ts",
|
|
34
|
+
"api-tool": "./src/api-tool/index.ts",
|
|
32
35
|
"audit-tool": "./src/audit-tool/index.ts",
|
|
33
36
|
"az-tool": "./src/az-tool/index.ts",
|
|
34
37
|
"azdo-tool": "./src/azdo-tool/index.ts",
|
|
@@ -43,6 +46,7 @@
|
|
|
43
46
|
"dist/",
|
|
44
47
|
"src/",
|
|
45
48
|
"schemas/",
|
|
49
|
+
"docs/rest-api-proxy.md",
|
|
46
50
|
"README.md",
|
|
47
51
|
"LICENSE"
|
|
48
52
|
],
|
|
@@ -100,6 +104,10 @@
|
|
|
100
104
|
"#session/*": {
|
|
101
105
|
"types": "./dist/session-tool/*.d.ts",
|
|
102
106
|
"default": "./src/session-tool/*.ts"
|
|
107
|
+
},
|
|
108
|
+
"#api/*": {
|
|
109
|
+
"types": "./dist/api-tool/*.d.ts",
|
|
110
|
+
"default": "./src/api-tool/*.ts"
|
|
103
111
|
}
|
|
104
112
|
},
|
|
105
113
|
"exports": {
|
|
@@ -126,6 +134,10 @@
|
|
|
126
134
|
"./prerequisites": {
|
|
127
135
|
"types": "./dist/shared/prerequisites/index.d.ts",
|
|
128
136
|
"default": "./src/shared/prerequisites/index.ts"
|
|
137
|
+
},
|
|
138
|
+
"./api": {
|
|
139
|
+
"types": "./dist/api-tool/client.d.ts",
|
|
140
|
+
"default": "./src/api-tool/client.ts"
|
|
129
141
|
}
|
|
130
142
|
},
|
|
131
143
|
"publishConfig": {
|
|
@@ -145,7 +157,9 @@
|
|
|
145
157
|
"session-tool": "bun src/session-tool/index.ts",
|
|
146
158
|
"update:packages": "bun update -i -r",
|
|
147
159
|
"update:skills": "bun run .agents/skills/update-packages/references/skills-update-local.ts",
|
|
148
|
-
"test": "vitest run"
|
|
160
|
+
"test": "vitest run",
|
|
161
|
+
"api-tool": "bun src/api-tool/index.ts",
|
|
162
|
+
"api-proxy": "bun src/api-tool/proxy-entry.ts"
|
|
149
163
|
},
|
|
150
164
|
"dependencies": {
|
|
151
165
|
"@effect/platform-bun": "4.0.0-rc.117",
|
|
@@ -0,0 +1,56 @@
|
|
|
1
|
+
import {
|
|
2
|
+
ClientSchema,
|
|
3
|
+
decode,
|
|
4
|
+
originUrl,
|
|
5
|
+
RequestSchema,
|
|
6
|
+
ResultSchema,
|
|
7
|
+
MAX_RESULT_ENVELOPE_BYTES,
|
|
8
|
+
} from "./types";
|
|
9
|
+
import type { ApiRequest, ApiResult, ClientConfig } from "./types";
|
|
10
|
+
import { apiError, ErrorCode, safeError } from "./errors";
|
|
11
|
+
import { pinnedTransport } from "./transport";
|
|
12
|
+
import type { Transport } from "./transport";
|
|
13
|
+
import { Schema } from "effect";
|
|
14
|
+
|
|
15
|
+
export function createApiClient(value: ClientConfig, transport: Transport = pinnedTransport) {
|
|
16
|
+
const config = decode(ClientSchema, value);
|
|
17
|
+
originUrl(config.proxyOrigin, config.developmentLoopback);
|
|
18
|
+
if (!/^[A-Za-z0-9_-]{32,256}$/.test(config.capability)) throw apiError("CONFIG_INVALID");
|
|
19
|
+
return {
|
|
20
|
+
request: async (input: ApiRequest): Promise<ApiResult> => {
|
|
21
|
+
const controller = new AbortController();
|
|
22
|
+
const timer = setTimeout(() => controller.abort(), 65000);
|
|
23
|
+
try {
|
|
24
|
+
const request = decode(RequestSchema, input);
|
|
25
|
+
const body = JSON.stringify(request);
|
|
26
|
+
if (Buffer.byteLength(body) > 1_000_000) throw apiError("LIMIT_EXCEEDED");
|
|
27
|
+
const response = await transport({
|
|
28
|
+
url: new URL("/request", config.proxyOrigin),
|
|
29
|
+
method: "POST",
|
|
30
|
+
headers: {
|
|
31
|
+
authorization: `Bearer ${config.capability}`,
|
|
32
|
+
"content-type": "application/json",
|
|
33
|
+
},
|
|
34
|
+
body,
|
|
35
|
+
maxBytes: MAX_RESULT_ENVELOPE_BYTES,
|
|
36
|
+
signal: controller.signal,
|
|
37
|
+
allowedPrivateAddresses: [],
|
|
38
|
+
developmentLoopback: config.developmentLoopback,
|
|
39
|
+
});
|
|
40
|
+
if (Buffer.byteLength(response.body) > MAX_RESULT_ENVELOPE_BYTES)
|
|
41
|
+
throw apiError("LIMIT_EXCEEDED");
|
|
42
|
+
if (response.status !== 200) {
|
|
43
|
+
const parsed = decode(Schema.Struct({ code: ErrorCode }), JSON.parse(response.body));
|
|
44
|
+
throw apiError(parsed.code);
|
|
45
|
+
}
|
|
46
|
+
return decode(ResultSchema, JSON.parse(response.body));
|
|
47
|
+
} catch (error) {
|
|
48
|
+
throw safeError(error);
|
|
49
|
+
} finally {
|
|
50
|
+
clearTimeout(timer);
|
|
51
|
+
}
|
|
52
|
+
},
|
|
53
|
+
};
|
|
54
|
+
}
|
|
55
|
+
export type { ApiRequest, ApiResult, ClientConfig } from "./types";
|
|
56
|
+
export { ApiError } from "./errors";
|