@haneinfo/settings 0.0.0-stage → 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 +14 -0
- package/README.md +165 -2
- package/agent-guide.md +22 -0
- package/dist/config.d.ts +11 -0
- package/dist/config.d.ts.map +1 -0
- package/dist/config.js +24 -0
- package/dist/config.js.map +1 -0
- package/dist/controller.d.ts +53 -0
- package/dist/controller.d.ts.map +1 -0
- package/dist/controller.js +188 -0
- package/dist/controller.js.map +1 -0
- package/dist/index.d.ts +7 -0
- package/dist/index.d.ts.map +1 -0
- package/dist/index.js +23 -0
- package/dist/index.js.map +1 -0
- package/dist/mcp-tools.d.ts +15 -0
- package/dist/mcp-tools.d.ts.map +1 -0
- package/dist/mcp-tools.js +144 -0
- package/dist/mcp-tools.js.map +1 -0
- package/dist/module.d.ts +6 -0
- package/dist/module.d.ts.map +1 -0
- package/dist/module.js +46 -0
- package/dist/module.js.map +1 -0
- package/dist/plugin.d.ts +18 -0
- package/dist/plugin.d.ts.map +1 -0
- package/dist/plugin.js +73 -0
- package/dist/plugin.js.map +1 -0
- package/dist/service.d.ts +104 -0
- package/dist/service.d.ts.map +1 -0
- package/dist/service.js +540 -0
- package/dist/service.js.map +1 -0
- package/dist/store.d.ts +74 -0
- package/dist/store.d.ts.map +1 -0
- package/dist/store.js +149 -0
- package/dist/store.js.map +1 -0
- package/haneinfo.plugin.json +55 -0
- package/package.json +65 -3
- package/plugin.d.ts +1 -0
- package/plugin.js +1 -0
- package/prisma/settings.prisma +43 -0
- package/prisma/settings.sql +39 -0
package/LICENSE
ADDED
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
Copyright (c) 2026 Haneinfo. All Rights Reserved.
|
|
2
|
+
|
|
3
|
+
This software and associated documentation files (the "Software") are the proprietary and
|
|
4
|
+
confidential property of Haneinfo. No part of the Software may be copied, modified, merged,
|
|
5
|
+
published, distributed, sublicensed, or sold without the prior written permission of Haneinfo.
|
|
6
|
+
|
|
7
|
+
The Software is provided for internal use by Haneinfo and its authorized personnel only, and is
|
|
8
|
+
NOT licensed for external distribution or open-source use.
|
|
9
|
+
|
|
10
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT
|
|
11
|
+
NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
|
|
12
|
+
NONINFRINGEMENT. IN NO EVENT SHALL HANEINFO BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY,
|
|
13
|
+
WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH
|
|
14
|
+
THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
package/README.md
CHANGED
|
@@ -1,3 +1,166 @@
|
|
|
1
|
-
#
|
|
1
|
+
# @haneinfo/settings
|
|
2
2
|
|
|
3
|
-
|
|
3
|
+
Runtime-adjustable settings and feature flags. Plugins declare the values that are safe to change
|
|
4
|
+
while the App runs; administrators override them over HTTP without redeploying, every change is
|
|
5
|
+
audited, agents can only propose changes, and `@haneinfo/mcp-server` uses it to switch off single
|
|
6
|
+
MCP tools. Implemented from draft decision 202610-e6c1; the decision remains draft. Version 0.0.0
|
|
7
|
+
has a minor changeset for the first release 0.1.0. There is no frontend (settings screen, flag rule
|
|
8
|
+
editor and proposal review come with a later decision), no scheduled rollout, no per-organization
|
|
9
|
+
rules and no fine-grained "who may change which setting".
|
|
10
|
+
|
|
11
|
+
Register `settings()` from `@haneinfo/settings/plugin` with configRef `settings`, or
|
|
12
|
+
`SettingsModule.register({})`. The module exports SettingsService, SettingsMcpTools, `SETTINGS`
|
|
13
|
+
(`haneinfo.settings`, the `SettingsPort`) and `SETTING_DECLARATIONS` (the declaration registry).
|
|
14
|
+
Requires plugin-api contract 1.22.0. The capability is optional: without this package every plugin
|
|
15
|
+
keeps reading its static configuration and nothing changes.
|
|
16
|
+
|
|
17
|
+
## What is (not) a setting
|
|
18
|
+
|
|
19
|
+
`haneinfo.config.ts` stays the only place for startup wiring: drivers, paths, connections, key
|
|
20
|
+
sources. Those must never be declared as settings. Settings never hold secrets: a declaration with
|
|
21
|
+
`sensitive` or `secret`, or a code segment that looks like a credential (password, token, apiKey,
|
|
22
|
+
databaseUrl, webhook, …), fails startup. Keys, passwords and connection strings belong in the
|
|
23
|
+
environment and static configuration only.
|
|
24
|
+
|
|
25
|
+
## Declarations
|
|
26
|
+
|
|
27
|
+
Contributors inject the optional registry and register during module initialization (their
|
|
28
|
+
manifests list `haneinfo.settings` in optionalRequires):
|
|
29
|
+
|
|
30
|
+
```ts
|
|
31
|
+
constructor(@Optional() @Inject(SETTING_DECLARATIONS) private readonly declarations?: SettingDeclarationRegistry) {}
|
|
32
|
+
onModuleInit() {
|
|
33
|
+
this.declarations?.register({
|
|
34
|
+
code: 'example.maxRows',
|
|
35
|
+
kind: 'setting',
|
|
36
|
+
type: 'integer',
|
|
37
|
+
description: 'Most rows a page returns',
|
|
38
|
+
default: 200,
|
|
39
|
+
min: 1,
|
|
40
|
+
max: 10000,
|
|
41
|
+
staticRef: 'example.maxRows',
|
|
42
|
+
});
|
|
43
|
+
}
|
|
44
|
+
```
|
|
45
|
+
|
|
46
|
+
| Field | Meaning |
|
|
47
|
+
| --- | --- |
|
|
48
|
+
| `code` | `<plugin>.<name>`: letters, digits, dots, hyphens, underscores; at most 128; globally unique (a duplicate fails startup) |
|
|
49
|
+
| `kind` | `setting` (a typed value) or `flag` (a boolean with optional rollout rules) |
|
|
50
|
+
| `type` | `boolean`, `integer`, `number`, `string`, `enum`, `stringList`; flags are `boolean` |
|
|
51
|
+
| `description` | 1–2,000 characters, shown to administrators and agents |
|
|
52
|
+
| `default` | must satisfy the declaration; a flag default may be a boolean |
|
|
53
|
+
| `min`, `max` | integer and number |
|
|
54
|
+
| `values` | enum: 1–200 distinct strings |
|
|
55
|
+
| `pattern` | string and stringList items: the whole value must match |
|
|
56
|
+
| `maxLength` | string and stringList items: 1–2,000 code points (2,000 is also the hard cap) |
|
|
57
|
+
| `maxItems` | stringList: 0–200 (200 is also the hard cap) |
|
|
58
|
+
| `staticRef` | optional dotted path into the App's static `runtime` configuration |
|
|
59
|
+
| `knownItems` | stringList only: a function listing names that exist; stored entries outside it are reported as `unknownItems` |
|
|
60
|
+
|
|
61
|
+
Value types exclude binary data and nested objects (only flag values are objects). Unknown
|
|
62
|
+
declaration properties are refused. A static value found at `staticRef` that does not satisfy the
|
|
63
|
+
declaration fails startup.
|
|
64
|
+
|
|
65
|
+
## Resolution and reading
|
|
66
|
+
|
|
67
|
+
A value resolves as runtime override > static configuration (`staticRef`) > declared default, and
|
|
68
|
+
reports `source` `OVERRIDE`, `STATIC` or `DEFAULT`. Deleting the override falls back to static or
|
|
69
|
+
default. An override that no longer satisfies a narrowed declaration is ignored (the view shows
|
|
70
|
+
`overrideProblems` and `storedValue`) until it is changed or deleted.
|
|
71
|
+
|
|
72
|
+
`SettingsPort` (inject `SETTINGS`) reads without a caller: `get(code)` → `{ code, value, source,
|
|
73
|
+
revision }`, `value(code)`, `evaluateFlag(code, { userId, roleNames? })` and `isEnabled(code,
|
|
74
|
+
subject)`. Undeclared codes throw SETTING_NOT_FOUND.
|
|
75
|
+
|
|
76
|
+
Reads go through an in-process cache (default 30 seconds). A write, delete or approved proposal on
|
|
77
|
+
this instance invalidates the code at once; other App instances follow within one cache period
|
|
78
|
+
(there is no NOTIFY or external cache). A read that raced a local write is never cached. A deleted
|
|
79
|
+
override therefore stops applying everywhere within one period.
|
|
80
|
+
|
|
81
|
+
## Feature flags
|
|
82
|
+
|
|
83
|
+
A flag value is `{ enabled: boolean, rules?: { allowUsers?, denyUsers?, allowRoles?, percent? } }`
|
|
84
|
+
(a boolean is accepted and stored as `{ enabled }`). Evaluation order: `denyUsers` (false) →
|
|
85
|
+
`allowUsers` (true) → `allowRoles`, any role (true) → `percent`, users whose stable bucket is below
|
|
86
|
+
the percentage (true) → `enabled`. Without rules a flag is a plain switch. Lists hold at most 200
|
|
87
|
+
entries; roles are machine names (`EQUIPMENT_MANAGER`); `percent` is an integer 0–100. When
|
|
88
|
+
`roleNames` is omitted the roles are loaded through RBAC.
|
|
89
|
+
|
|
90
|
+
The bucket is plugin-api's `settingFlagBucket(code, userId)`: 32-bit FNV-1a over the UTF-8 bytes of
|
|
91
|
+
`<code>:<userId>`, modulo 100. The same person always gets the same result for a flag; raising the
|
|
92
|
+
percentage only adds people. `SETTING_FLAG_BUCKET_TEST_VECTORS` pins the function.
|
|
93
|
+
|
|
94
|
+
## Data and migration
|
|
95
|
+
|
|
96
|
+
Apply `prisma/settings.prisma` and the App migration in `prisma/settings.sql` before enabling. No
|
|
97
|
+
relation to other models is needed.
|
|
98
|
+
|
|
99
|
+
| Model / table | Columns |
|
|
100
|
+
| --- | --- |
|
|
101
|
+
| Setting / settings | code (primary key), value JSONB, revision, updatedBy, updatedAt. No override, no row. |
|
|
102
|
+
| SettingChange / setting_changes | id, code, before, after (JSONB, NULL when there was no override), actorId, reason, source (`HTTP`, `PROPOSAL`; CHECK), at; index (code, at) |
|
|
103
|
+
| SettingProposal / setting_proposals | id, code, value, reason, proposedBy, status (`PENDING`, `APPLIED`, `REJECTED`; CHECK), decidedBy, decidedAt, createdAt; unique partial index: one PENDING per code |
|
|
104
|
+
|
|
105
|
+
Overrides whose code no plugin declares any more stay in the table and are listed as `ORPHAN`; they
|
|
106
|
+
can be read and deleted but not set. Back up these tables with the rest of the database.
|
|
107
|
+
|
|
108
|
+
## HTTP
|
|
109
|
+
|
|
110
|
+
All routes use InteractiveAuthGuard (401 without a login). Reads need `settings:setting:read`,
|
|
111
|
+
changes and proposal decisions need `settings:setting:write` (403 otherwise; ADMIN, ALLOW_ALL and
|
|
112
|
+
READ_ALL for reads apply as usual). Without an RBAC plugin every route is 403.
|
|
113
|
+
|
|
114
|
+
| Route | Notes |
|
|
115
|
+
| --- | --- |
|
|
116
|
+
| `GET /settings` | `{ items }`: every declaration with value, source, default, constraints, staticRef, revision (0 = no override), updatedBy, updatedAt, unknownItems; then ORPHAN overrides; sorted by code |
|
|
117
|
+
| `GET /settings/:code` | one item |
|
|
118
|
+
| `PUT /settings/:code` | `{ value, expectedRevision?, reason? }`; validated against the declaration and `maxValueBytes`; an unchanged override returns 200 without an audit record |
|
|
119
|
+
| `DELETE /settings/:code?expectedRevision=&reason=` | removes the override (204); no override is a no-op |
|
|
120
|
+
| `GET /settings/:code/history?offset=&limit=` | `{ items, total, offset, limit }`, newest first |
|
|
121
|
+
| `POST /settings/flags/:code/evaluate` | `{ userId }` → `{ code, userId, enabled, matched, bucket, source, revision }` for debugging |
|
|
122
|
+
| `GET /settings/proposals?status=&offset=&limit=` | `{ items, total, offset, limit }`, newest first |
|
|
123
|
+
| `POST /settings/proposals/:id/approve` | `{ reason? }`: applies the value as the approver (audit source PROPOSAL), returns `{ proposal, setting }` |
|
|
124
|
+
| `POST /settings/proposals/:id/reject` | marks REJECTED |
|
|
125
|
+
|
|
126
|
+
`expectedRevision` 0 means "expect no override". After a delete the next override starts again at
|
|
127
|
+
revision 1. A write, delete or approval runs in one transaction under a per-code advisory lock: the
|
|
128
|
+
override, its SettingChange row and the `settings.changed` domain event (when
|
|
129
|
+
`@haneinfo/domain-events` is installed) commit together. The event carries code, revision (0 after
|
|
130
|
+
a delete), actor and source, never the value. Change records are only appended; there is no update
|
|
131
|
+
or delete API (only the optional retention limit prunes the oldest).
|
|
132
|
+
|
|
133
|
+
Errors use the shared envelope: SETTING_NOT_FOUND / 404, SETTING_INVALID / 400 with
|
|
134
|
+
`details.problems` (`[{ path, message }]`), SETTING_REVISION_CONFLICT / 409 with
|
|
135
|
+
`details.currentRevision`, SETTING_PROPOSAL_NOT_FOUND / 404, SETTING_PROPOSAL_NOT_PENDING / 409 and
|
|
136
|
+
FORBIDDEN / 403.
|
|
137
|
+
|
|
138
|
+
## Agent proposals (MCP)
|
|
139
|
+
|
|
140
|
+
Register SettingsMcpTools with `registerInto(registry, { scopeNamespace })`.
|
|
141
|
+
|
|
142
|
+
| Tool | Scope | Notes |
|
|
143
|
+
| --- | --- | --- |
|
|
144
|
+
| list_settings | `<namespace>:settings:read` | same items as `GET /settings` |
|
|
145
|
+
| get_setting | `<namespace>:settings:read` | `{ code }` |
|
|
146
|
+
| propose_setting_change | `<namespace>:settings:propose` | `{ code, value, reason? }` → a PENDING proposal |
|
|
147
|
+
|
|
148
|
+
Every tool must be user-bound and acts with that user's `settings:setting:read`. Proposals are
|
|
149
|
+
validated exactly like a write; a newer proposal for the same code replaces the pending one (marked
|
|
150
|
+
REJECTED without a decider). Nothing changes until a person approves it. Descriptions, values,
|
|
151
|
+
defaults and reasons are wrapped as `$userContent`. There is no MCP tool that changes, deletes or
|
|
152
|
+
approves a setting.
|
|
153
|
+
|
|
154
|
+
## Switching off MCP tools
|
|
155
|
+
|
|
156
|
+
With this package installed, `@haneinfo/mcp-server` declares `mcp-server.disabledTools`
|
|
157
|
+
(stringList of tool names, at most 200). Listed tools disappear from tools/list and a direct
|
|
158
|
+
tools/call returns the error `TOOL_DISABLED` without running the handler; prefixed aliases follow
|
|
159
|
+
their tool. Names that do not exist are ignored and reported as `unknownItems`. Without this
|
|
160
|
+
package the MCP server behaves exactly as before.
|
|
161
|
+
|
|
162
|
+
## Configuration
|
|
163
|
+
|
|
164
|
+
`runtime.settings` has no secrets: cacheTtlMs 30,000 (0–3,600,000; 0 disables the cache),
|
|
165
|
+
maxValueBytes 8,192 (256–65,536, UTF-8 bytes of the value JSON), historyPageMaxLimit 100 (1–1,000)
|
|
166
|
+
and maxHistoryPerCode (absent keeps every record; 1–1,000,000).
|
package/agent-guide.md
ADDED
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
# Settings agent guide
|
|
2
|
+
|
|
3
|
+
Use this optional backend for runtime-adjustable settings and feature flags under draft 202610-e6c1;
|
|
4
|
+
the decision remains draft. Read [README.md](README.md) for declarations, value types, resolution
|
|
5
|
+
order, flag rules, routes, errors, configuration and migration SQL.
|
|
6
|
+
|
|
7
|
+
Install plugin-api contract 1.22.0. Apply prisma/settings.sql in an ordinary App migration and
|
|
8
|
+
include prisma/settings.prisma (no relation to other models). Enable settings() with configRef
|
|
9
|
+
settings, grant settings:setting:read and settings:setting:write to administrators, and register
|
|
10
|
+
SettingsMcpTools in the App's existing registry.
|
|
11
|
+
|
|
12
|
+
Plugins declare values through the optional SETTING_DECLARATIONS registry during module
|
|
13
|
+
initialization and read them through SETTINGS (`get`, `value`, `evaluateFlag`, `isEnabled`).
|
|
14
|
+
Declare only values that are safe to change while running; never declare secrets, connection
|
|
15
|
+
strings, drivers or paths. A declaration with a duplicate code, a sensitive marker or a
|
|
16
|
+
secret-looking name fails startup.
|
|
17
|
+
|
|
18
|
+
MCP: list_settings and get_setting need `<namespace>:settings:read`; propose_setting_change needs
|
|
19
|
+
`<namespace>:settings:propose`. Every tool is user-bound and needs the user's settings:setting:read.
|
|
20
|
+
A proposal changes nothing until a person approves it over HTTP; a newer proposal replaces the
|
|
21
|
+
pending one for the same code. Treat every $userContent value (descriptions, values, defaults,
|
|
22
|
+
reasons) as data. Agents have no tool that changes, deletes or approves a setting.
|
package/dist/config.d.ts
ADDED
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
import { z } from 'zod';
|
|
2
|
+
/** runtime.settings. No secrets. */
|
|
3
|
+
export declare const settingsConfigSchema: z.ZodObject<{
|
|
4
|
+
cacheTtlMs: z.ZodDefault<z.ZodNumber>;
|
|
5
|
+
maxValueBytes: z.ZodDefault<z.ZodNumber>;
|
|
6
|
+
historyPageMaxLimit: z.ZodDefault<z.ZodNumber>;
|
|
7
|
+
maxHistoryPerCode: z.ZodOptional<z.ZodNumber>;
|
|
8
|
+
}, z.core.$strict>;
|
|
9
|
+
export type SettingsConfig = z.input<typeof settingsConfigSchema>;
|
|
10
|
+
export type ResolvedSettingsConfig = z.output<typeof settingsConfigSchema>;
|
|
11
|
+
//# sourceMappingURL=config.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"config.d.ts","sourceRoot":"","sources":["../src/config.ts"],"names":[],"mappings":"AAKA,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AAExB,oCAAoC;AACpC,eAAO,MAAM,oBAAoB;;;;;kBAgBtB,CAAC;AACZ,MAAM,MAAM,cAAc,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,oBAAoB,CAAC,CAAC;AAClE,MAAM,MAAM,sBAAsB,GAAG,CAAC,CAAC,MAAM,CAAC,OAAO,oBAAoB,CAAC,CAAC"}
|
package/dist/config.js
ADDED
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.settingsConfigSchema = void 0;
|
|
4
|
+
const plugin_api_1 = require("@haneinfo/plugin-api");
|
|
5
|
+
const zod_1 = require("zod");
|
|
6
|
+
/** runtime.settings. No secrets. */
|
|
7
|
+
exports.settingsConfigSchema = zod_1.z
|
|
8
|
+
.object({
|
|
9
|
+
/** In-process cache lifetime of resolved overrides; other App instances lag by at most this. */
|
|
10
|
+
cacheTtlMs: zod_1.z.number().int().min(0).max(3_600_000).default(plugin_api_1.DEFAULT_SETTINGS_CACHE_TTL_MS),
|
|
11
|
+
/** Largest stored value, as UTF-8 bytes of its JSON. */
|
|
12
|
+
maxValueBytes: zod_1.z.number().int().min(256).max(65_536).default(plugin_api_1.DEFAULT_SETTING_MAX_VALUE_BYTES),
|
|
13
|
+
/** Upper bound of `limit` on history and proposal pages. */
|
|
14
|
+
historyPageMaxLimit: zod_1.z
|
|
15
|
+
.number()
|
|
16
|
+
.int()
|
|
17
|
+
.min(1)
|
|
18
|
+
.max(1000)
|
|
19
|
+
.default(plugin_api_1.DEFAULT_SETTING_HISTORY_PAGE_MAX),
|
|
20
|
+
/** Change records kept per code (oldest pruned first); absent keeps all of them. */
|
|
21
|
+
maxHistoryPerCode: zod_1.z.number().int().min(1).max(1_000_000).optional(),
|
|
22
|
+
})
|
|
23
|
+
.strict();
|
|
24
|
+
//# sourceMappingURL=config.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"config.js","sourceRoot":"","sources":["../src/config.ts"],"names":[],"mappings":";;;AAAA,qDAI8B;AAC9B,6BAAwB;AAExB,oCAAoC;AACvB,QAAA,oBAAoB,GAAG,OAAC;KAClC,MAAM,CAAC;IACN,gGAAgG;IAChG,UAAU,EAAE,OAAC,CAAC,MAAM,EAAE,CAAC,GAAG,EAAE,CAAC,GAAG,CAAC,CAAC,CAAC,CAAC,GAAG,CAAC,SAAS,CAAC,CAAC,OAAO,CAAC,0CAA6B,CAAC;IACzF,wDAAwD;IACxD,aAAa,EAAE,OAAC,CAAC,MAAM,EAAE,CAAC,GAAG,EAAE,CAAC,GAAG,CAAC,GAAG,CAAC,CAAC,GAAG,CAAC,MAAM,CAAC,CAAC,OAAO,CAAC,4CAA+B,CAAC;IAC7F,4DAA4D;IAC5D,mBAAmB,EAAE,OAAC;SACnB,MAAM,EAAE;SACR,GAAG,EAAE;SACL,GAAG,CAAC,CAAC,CAAC;SACN,GAAG,CAAC,IAAI,CAAC;SACT,OAAO,CAAC,6CAAgC,CAAC;IAC5C,oFAAoF;IACpF,iBAAiB,EAAE,OAAC,CAAC,MAAM,EAAE,CAAC,GAAG,EAAE,CAAC,GAAG,CAAC,CAAC,CAAC,CAAC,GAAG,CAAC,SAAS,CAAC,CAAC,QAAQ,EAAE;CACrE,CAAC;KACD,MAAM,EAAE,CAAC"}
|
|
@@ -0,0 +1,53 @@
|
|
|
1
|
+
import { type InteractivePrincipal, type SettingProposalStatus } from '@haneinfo/plugin-api';
|
|
2
|
+
import { SettingsService } from './service';
|
|
3
|
+
export declare function settingsPageFromHttp(query: Record<string, unknown> | undefined): {
|
|
4
|
+
offset: number | undefined;
|
|
5
|
+
limit: number | undefined;
|
|
6
|
+
};
|
|
7
|
+
export declare function proposalQueryFromHttp(query: Record<string, unknown> | undefined): {
|
|
8
|
+
status: SettingProposalStatus | undefined;
|
|
9
|
+
offset: number | undefined;
|
|
10
|
+
limit: number | undefined;
|
|
11
|
+
};
|
|
12
|
+
export declare function deleteOptionsFromHttp(query: Record<string, unknown> | undefined): {
|
|
13
|
+
reason?: {} | null | undefined;
|
|
14
|
+
expectedRevision?: number | undefined;
|
|
15
|
+
};
|
|
16
|
+
/** Interactive administration. Reads need settings:setting:read, changes settings:setting:write. */
|
|
17
|
+
export declare class SettingsController {
|
|
18
|
+
private readonly settings;
|
|
19
|
+
constructor(settings: SettingsService);
|
|
20
|
+
list(user: InteractivePrincipal): Promise<{
|
|
21
|
+
items: import("@haneinfo/plugin-api").SettingView[];
|
|
22
|
+
}>;
|
|
23
|
+
proposals(user: InteractivePrincipal, query: Record<string, unknown>): Promise<{
|
|
24
|
+
offset: number;
|
|
25
|
+
limit: number;
|
|
26
|
+
items: import("@haneinfo/plugin-api").SettingProposalRecord[];
|
|
27
|
+
total: number;
|
|
28
|
+
}>;
|
|
29
|
+
approve(user: InteractivePrincipal, id: string, body: unknown): Promise<{
|
|
30
|
+
proposal: import("@haneinfo/plugin-api").SettingProposalRecord;
|
|
31
|
+
setting: import("@haneinfo/plugin-api").SettingView;
|
|
32
|
+
}>;
|
|
33
|
+
reject(user: InteractivePrincipal, id: string, body: unknown): Promise<import("@haneinfo/plugin-api").SettingProposalRecord>;
|
|
34
|
+
evaluate(user: InteractivePrincipal, code: string, body: unknown): Promise<{
|
|
35
|
+
userId: string;
|
|
36
|
+
source: "OVERRIDE" | "STATIC" | "DEFAULT";
|
|
37
|
+
revision: number;
|
|
38
|
+
enabled: boolean;
|
|
39
|
+
matched: import("@haneinfo/plugin-api").SettingFlagMatch;
|
|
40
|
+
bucket: number | null;
|
|
41
|
+
code: string;
|
|
42
|
+
}>;
|
|
43
|
+
history(user: InteractivePrincipal, code: string, query: Record<string, unknown>): Promise<{
|
|
44
|
+
offset: number;
|
|
45
|
+
limit: number;
|
|
46
|
+
items: import("@haneinfo/plugin-api").SettingChangeRecord[];
|
|
47
|
+
total: number;
|
|
48
|
+
}>;
|
|
49
|
+
get(user: InteractivePrincipal, code: string): Promise<import("@haneinfo/plugin-api").SettingView>;
|
|
50
|
+
put(user: InteractivePrincipal, code: string, body: unknown): Promise<import("@haneinfo/plugin-api").SettingView>;
|
|
51
|
+
remove(user: InteractivePrincipal, code: string, query: Record<string, unknown>): Promise<void>;
|
|
52
|
+
}
|
|
53
|
+
//# sourceMappingURL=controller.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"controller.d.ts","sourceRoot":"","sources":["../src/controller.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,KAAK,oBAAoB,EAGzB,KAAK,qBAAqB,EAC3B,MAAM,sBAAsB,CAAC;AAgB9B,OAAO,EAAE,eAAe,EAAE,MAAM,WAAW,CAAC;AAwB5C,wBAAgB,oBAAoB,CAAC,KAAK,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,GAAG,SAAS;;;EAG9E;AACD,wBAAgB,qBAAqB,CAAC,KAAK,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,GAAG,SAAS;YAG1D,qBAAqB,GAAG,SAAS;;;EAItD;AACD,wBAAgB,qBAAqB,CAAC,KAAK,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,GAAG,SAAS;;;EAM/E;AAED,oGAAoG;AACpG,qBAEa,kBAAkB;IACQ,OAAO,CAAC,QAAQ,CAAC,QAAQ;gBAAR,QAAQ,EAAE,eAAe;IAE/E,IAAI,CAAgB,IAAI,EAAE,oBAAoB;;;IAK9C,SAAS,CAAgB,IAAI,EAAE,oBAAoB,EAAW,KAAK,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC;;;;;;IAK5F,OAAO,CACU,IAAI,EAAE,oBAAoB,EAC5B,EAAE,EAAE,MAAM,EACf,IAAI,EAAE,OAAO;;;;IAMvB,MAAM,CACW,IAAI,EAAE,oBAAoB,EAC5B,EAAE,EAAE,MAAM,EACf,IAAI,EAAE,OAAO;IAMvB,QAAQ,CACS,IAAI,EAAE,oBAAoB,EAC1B,IAAI,EAAE,MAAM,EACnB,IAAI,EAAE,OAAO;;;;;;;;;IAKvB,OAAO,CACU,IAAI,EAAE,oBAAoB,EAC1B,IAAI,EAAE,MAAM,EAClB,KAAK,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC;;;;;;IAKzC,GAAG,CAAgB,IAAI,EAAE,oBAAoB,EAAiB,IAAI,EAAE,MAAM;IAI1E,GAAG,CACc,IAAI,EAAE,oBAAoB,EAC1B,IAAI,EAAE,MAAM,EACnB,IAAI,EAAE,OAAO;IAMjB,MAAM,CACK,IAAI,EAAE,oBAAoB,EAC1B,IAAI,EAAE,MAAM,EAClB,KAAK,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC;CAI1C"}
|
|
@@ -0,0 +1,188 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __decorate = (this && this.__decorate) || function (decorators, target, key, desc) {
|
|
3
|
+
var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
|
|
4
|
+
if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
|
|
5
|
+
else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
|
|
6
|
+
return c > 3 && r && Object.defineProperty(target, key, r), r;
|
|
7
|
+
};
|
|
8
|
+
var __metadata = (this && this.__metadata) || function (k, v) {
|
|
9
|
+
if (typeof Reflect === "object" && typeof Reflect.metadata === "function") return Reflect.metadata(k, v);
|
|
10
|
+
};
|
|
11
|
+
var __param = (this && this.__param) || function (paramIndex, decorator) {
|
|
12
|
+
return function (target, key) { decorator(target, key, paramIndex); }
|
|
13
|
+
};
|
|
14
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
15
|
+
exports.SettingsController = void 0;
|
|
16
|
+
exports.settingsPageFromHttp = settingsPageFromHttp;
|
|
17
|
+
exports.proposalQueryFromHttp = proposalQueryFromHttp;
|
|
18
|
+
exports.deleteOptionsFromHttp = deleteOptionsFromHttp;
|
|
19
|
+
const plugin_api_1 = require("@haneinfo/plugin-api");
|
|
20
|
+
const plugin_host_nest_1 = require("@haneinfo/plugin-host-nest");
|
|
21
|
+
const common_1 = require("@nestjs/common");
|
|
22
|
+
const service_1 = require("./service");
|
|
23
|
+
async function run(work) {
|
|
24
|
+
try {
|
|
25
|
+
return await work();
|
|
26
|
+
}
|
|
27
|
+
catch (error) {
|
|
28
|
+
if (error instanceof plugin_api_1.MechanismError)
|
|
29
|
+
throw new common_1.HttpException(error.toJSON(), error.status);
|
|
30
|
+
throw error;
|
|
31
|
+
}
|
|
32
|
+
}
|
|
33
|
+
/** Query-string values arrive as strings; anything else (repeated keys, objects) stays invalid. */
|
|
34
|
+
function integer(value) {
|
|
35
|
+
if (value === undefined)
|
|
36
|
+
return undefined;
|
|
37
|
+
return typeof value === 'string' && /^\d{1,9}$/.test(value) ? Number(value) : Number.NaN;
|
|
38
|
+
}
|
|
39
|
+
function onlyQuery(query, allowed) {
|
|
40
|
+
const unknown = Object.keys(query ?? {}).filter((key) => !allowed.includes(key));
|
|
41
|
+
if (unknown.length)
|
|
42
|
+
throw new plugin_api_1.MechanismError(plugin_api_1.SETTING_ERROR_CODES.invalid, 'Invalid request', 400, undefined, [], {
|
|
43
|
+
problems: unknown.map((path) => ({ path, message: 'Unknown query parameter' })),
|
|
44
|
+
});
|
|
45
|
+
return query ?? {};
|
|
46
|
+
}
|
|
47
|
+
function settingsPageFromHttp(query) {
|
|
48
|
+
const { offset, limit } = onlyQuery(query, ['offset', 'limit']);
|
|
49
|
+
return { offset: integer(offset), limit: integer(limit) };
|
|
50
|
+
}
|
|
51
|
+
function proposalQueryFromHttp(query) {
|
|
52
|
+
const { status, offset, limit } = onlyQuery(query, ['status', 'offset', 'limit']);
|
|
53
|
+
return {
|
|
54
|
+
status: status,
|
|
55
|
+
offset: integer(offset),
|
|
56
|
+
limit: integer(limit),
|
|
57
|
+
};
|
|
58
|
+
}
|
|
59
|
+
function deleteOptionsFromHttp(query) {
|
|
60
|
+
const { expectedRevision, reason } = onlyQuery(query, ['expectedRevision', 'reason']);
|
|
61
|
+
return {
|
|
62
|
+
...(expectedRevision === undefined ? {} : { expectedRevision: integer(expectedRevision) }),
|
|
63
|
+
...(reason === undefined ? {} : { reason }),
|
|
64
|
+
};
|
|
65
|
+
}
|
|
66
|
+
/** Interactive administration. Reads need settings:setting:read, changes settings:setting:write. */
|
|
67
|
+
let SettingsController = class SettingsController {
|
|
68
|
+
constructor(settings) {
|
|
69
|
+
this.settings = settings;
|
|
70
|
+
}
|
|
71
|
+
list(user) {
|
|
72
|
+
return run(() => this.settings.listFor(user.sub));
|
|
73
|
+
}
|
|
74
|
+
// Fixed paths come before `:code`; codes always contain a dot, so they never collide.
|
|
75
|
+
proposals(user, query) {
|
|
76
|
+
return run(() => this.settings.proposalsFor(user.sub, proposalQueryFromHttp(query)));
|
|
77
|
+
}
|
|
78
|
+
approve(user, id, body) {
|
|
79
|
+
return run(() => this.settings.approveFor(user.sub, id, body));
|
|
80
|
+
}
|
|
81
|
+
reject(user, id, body) {
|
|
82
|
+
return run(() => this.settings.rejectFor(user.sub, id, body));
|
|
83
|
+
}
|
|
84
|
+
evaluate(user, code, body) {
|
|
85
|
+
return run(() => this.settings.evaluateFor(user.sub, code, body));
|
|
86
|
+
}
|
|
87
|
+
history(user, code, query) {
|
|
88
|
+
return run(() => this.settings.historyFor(user.sub, code, settingsPageFromHttp(query)));
|
|
89
|
+
}
|
|
90
|
+
get(user, code) {
|
|
91
|
+
return run(() => this.settings.getFor(user.sub, code));
|
|
92
|
+
}
|
|
93
|
+
put(user, code, body) {
|
|
94
|
+
return run(() => this.settings.putFor(user.sub, code, body));
|
|
95
|
+
}
|
|
96
|
+
async remove(user, code, query) {
|
|
97
|
+
await run(() => this.settings.deleteFor(user.sub, code, deleteOptionsFromHttp(query)));
|
|
98
|
+
}
|
|
99
|
+
};
|
|
100
|
+
exports.SettingsController = SettingsController;
|
|
101
|
+
__decorate([
|
|
102
|
+
(0, common_1.Get)(),
|
|
103
|
+
__param(0, (0, plugin_host_nest_1.CurrentUser)()),
|
|
104
|
+
__metadata("design:type", Function),
|
|
105
|
+
__metadata("design:paramtypes", [Object]),
|
|
106
|
+
__metadata("design:returntype", void 0)
|
|
107
|
+
], SettingsController.prototype, "list", null);
|
|
108
|
+
__decorate([
|
|
109
|
+
(0, common_1.Get)('proposals'),
|
|
110
|
+
__param(0, (0, plugin_host_nest_1.CurrentUser)()),
|
|
111
|
+
__param(1, (0, common_1.Query)()),
|
|
112
|
+
__metadata("design:type", Function),
|
|
113
|
+
__metadata("design:paramtypes", [Object, Object]),
|
|
114
|
+
__metadata("design:returntype", void 0)
|
|
115
|
+
], SettingsController.prototype, "proposals", null);
|
|
116
|
+
__decorate([
|
|
117
|
+
(0, common_1.Post)('proposals/:id/approve'),
|
|
118
|
+
(0, common_1.HttpCode)(200),
|
|
119
|
+
__param(0, (0, plugin_host_nest_1.CurrentUser)()),
|
|
120
|
+
__param(1, (0, common_1.Param)('id')),
|
|
121
|
+
__param(2, (0, common_1.Body)()),
|
|
122
|
+
__metadata("design:type", Function),
|
|
123
|
+
__metadata("design:paramtypes", [Object, String, Object]),
|
|
124
|
+
__metadata("design:returntype", void 0)
|
|
125
|
+
], SettingsController.prototype, "approve", null);
|
|
126
|
+
__decorate([
|
|
127
|
+
(0, common_1.Post)('proposals/:id/reject'),
|
|
128
|
+
(0, common_1.HttpCode)(200),
|
|
129
|
+
__param(0, (0, plugin_host_nest_1.CurrentUser)()),
|
|
130
|
+
__param(1, (0, common_1.Param)('id')),
|
|
131
|
+
__param(2, (0, common_1.Body)()),
|
|
132
|
+
__metadata("design:type", Function),
|
|
133
|
+
__metadata("design:paramtypes", [Object, String, Object]),
|
|
134
|
+
__metadata("design:returntype", void 0)
|
|
135
|
+
], SettingsController.prototype, "reject", null);
|
|
136
|
+
__decorate([
|
|
137
|
+
(0, common_1.Post)('flags/:code/evaluate'),
|
|
138
|
+
(0, common_1.HttpCode)(200),
|
|
139
|
+
__param(0, (0, plugin_host_nest_1.CurrentUser)()),
|
|
140
|
+
__param(1, (0, common_1.Param)('code')),
|
|
141
|
+
__param(2, (0, common_1.Body)()),
|
|
142
|
+
__metadata("design:type", Function),
|
|
143
|
+
__metadata("design:paramtypes", [Object, String, Object]),
|
|
144
|
+
__metadata("design:returntype", void 0)
|
|
145
|
+
], SettingsController.prototype, "evaluate", null);
|
|
146
|
+
__decorate([
|
|
147
|
+
(0, common_1.Get)(':code/history'),
|
|
148
|
+
__param(0, (0, plugin_host_nest_1.CurrentUser)()),
|
|
149
|
+
__param(1, (0, common_1.Param)('code')),
|
|
150
|
+
__param(2, (0, common_1.Query)()),
|
|
151
|
+
__metadata("design:type", Function),
|
|
152
|
+
__metadata("design:paramtypes", [Object, String, Object]),
|
|
153
|
+
__metadata("design:returntype", void 0)
|
|
154
|
+
], SettingsController.prototype, "history", null);
|
|
155
|
+
__decorate([
|
|
156
|
+
(0, common_1.Get)(':code'),
|
|
157
|
+
__param(0, (0, plugin_host_nest_1.CurrentUser)()),
|
|
158
|
+
__param(1, (0, common_1.Param)('code')),
|
|
159
|
+
__metadata("design:type", Function),
|
|
160
|
+
__metadata("design:paramtypes", [Object, String]),
|
|
161
|
+
__metadata("design:returntype", void 0)
|
|
162
|
+
], SettingsController.prototype, "get", null);
|
|
163
|
+
__decorate([
|
|
164
|
+
(0, common_1.Put)(':code'),
|
|
165
|
+
__param(0, (0, plugin_host_nest_1.CurrentUser)()),
|
|
166
|
+
__param(1, (0, common_1.Param)('code')),
|
|
167
|
+
__param(2, (0, common_1.Body)()),
|
|
168
|
+
__metadata("design:type", Function),
|
|
169
|
+
__metadata("design:paramtypes", [Object, String, Object]),
|
|
170
|
+
__metadata("design:returntype", void 0)
|
|
171
|
+
], SettingsController.prototype, "put", null);
|
|
172
|
+
__decorate([
|
|
173
|
+
(0, common_1.Delete)(':code'),
|
|
174
|
+
(0, common_1.HttpCode)(204),
|
|
175
|
+
__param(0, (0, plugin_host_nest_1.CurrentUser)()),
|
|
176
|
+
__param(1, (0, common_1.Param)('code')),
|
|
177
|
+
__param(2, (0, common_1.Query)()),
|
|
178
|
+
__metadata("design:type", Function),
|
|
179
|
+
__metadata("design:paramtypes", [Object, String, Object]),
|
|
180
|
+
__metadata("design:returntype", Promise)
|
|
181
|
+
], SettingsController.prototype, "remove", null);
|
|
182
|
+
exports.SettingsController = SettingsController = __decorate([
|
|
183
|
+
(0, common_1.Controller)('settings'),
|
|
184
|
+
(0, common_1.UseGuards)(plugin_host_nest_1.InteractiveAuthGuard),
|
|
185
|
+
__param(0, (0, common_1.Inject)(service_1.SettingsService)),
|
|
186
|
+
__metadata("design:paramtypes", [service_1.SettingsService])
|
|
187
|
+
], SettingsController);
|
|
188
|
+
//# sourceMappingURL=controller.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"controller.js","sourceRoot":"","sources":["../src/controller.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;AA6CA,oDAGC;AACD,sDAOC;AACD,sDAMC;AA/DD,qDAK8B;AAC9B,iEAA+E;AAC/E,2CAawB;AACxB,uCAA4C;AAE5C,KAAK,UAAU,GAAG,CAAI,IAAsB;IAC1C,IAAI,CAAC;QACH,OAAO,MAAM,IAAI,EAAE,CAAC;IACtB,CAAC;IAAC,OAAO,KAAK,EAAE,CAAC;QACf,IAAI,KAAK,YAAY,2BAAc;YAAE,MAAM,IAAI,sBAAa,CAAC,KAAK,CAAC,MAAM,EAAE,EAAE,KAAK,CAAC,MAAM,CAAC,CAAC;QAC3F,MAAM,KAAK,CAAC;IACd,CAAC;AACH,CAAC;AAED,mGAAmG;AACnG,SAAS,OA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AAM,CAAC,CAAA;;;;6CAE5D;AAED;IADC,IAAA,YAAG,EAAC,OAAO,CAAC;IAEV,WAAA,IAAA,8BAAW,GAAE,CAAA;IACb,WAAA,IAAA,cAAK,EAAC,MAAM,CAAC,CAAA;IACb,WAAA,IAAA,aAAI,GAAE,CAAA;;;;6CAGR;AAGK;IAFL,IAAA,eAAM,EAAC,OAAO,CAAC;IACf,IAAA,iBAAQ,EAAC,GAAG,CAAC;IAEX,WAAA,IAAA,8BAAW,GAAE,CAAA;IACb,WAAA,IAAA,cAAK,EAAC,MAAM,CAAC,CAAA;IACb,WAAA,IAAA,cAAK,GAAE,CAAA;;;;gDAGT;6BAlEU,kBAAkB;IAF9B,IAAA,mBAAU,EAAC,UAAU,CAAC;IACtB,IAAA,kBAAS,EAAC,uCAAoB,CAAC;IAEjB,WAAA,IAAA,eAAM,EAAC,yBAAe,CAAC,CAAA;qCAA4B,yBAAe;GADpE,kBAAkB,CAmE9B"}
|
package/dist/index.d.ts
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,cAAc,UAAU,CAAC;AACzB,cAAc,cAAc,CAAC;AAC7B,cAAc,aAAa,CAAC;AAC5B,cAAc,UAAU,CAAC;AACzB,cAAc,WAAW,CAAC;AAC1B,cAAc,SAAS,CAAC"}
|
package/dist/index.js
ADDED
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
|
3
|
+
if (k2 === undefined) k2 = k;
|
|
4
|
+
var desc = Object.getOwnPropertyDescriptor(m, k);
|
|
5
|
+
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
|
|
6
|
+
desc = { enumerable: true, get: function() { return m[k]; } };
|
|
7
|
+
}
|
|
8
|
+
Object.defineProperty(o, k2, desc);
|
|
9
|
+
}) : (function(o, m, k, k2) {
|
|
10
|
+
if (k2 === undefined) k2 = k;
|
|
11
|
+
o[k2] = m[k];
|
|
12
|
+
}));
|
|
13
|
+
var __exportStar = (this && this.__exportStar) || function(m, exports) {
|
|
14
|
+
for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
|
|
15
|
+
};
|
|
16
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
17
|
+
__exportStar(require("./config"), exports);
|
|
18
|
+
__exportStar(require("./controller"), exports);
|
|
19
|
+
__exportStar(require("./mcp-tools"), exports);
|
|
20
|
+
__exportStar(require("./module"), exports);
|
|
21
|
+
__exportStar(require("./service"), exports);
|
|
22
|
+
__exportStar(require("./store"), exports);
|
|
23
|
+
//# sourceMappingURL=index.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;AAAA,2CAAyB;AACzB,+CAA6B;AAC7B,8CAA4B;AAC5B,2CAAyB;AACzB,4CAA0B;AAC1B,0CAAwB"}
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
import { type McpToolsPort } from '@haneinfo/plugin-api';
|
|
2
|
+
import { SettingsService } from './service';
|
|
3
|
+
export declare const SETTINGS_MCP_TOOLS: readonly ["list_settings", "get_setting", "propose_setting_change"];
|
|
4
|
+
export declare class SettingsMcpTools {
|
|
5
|
+
private readonly settings;
|
|
6
|
+
constructor(settings: SettingsService);
|
|
7
|
+
/**
|
|
8
|
+
* Agents read settings and propose changes; a person approves or rejects every proposal over
|
|
9
|
+
* HTTP. There is deliberately no MCP tool that changes, deletes or approves a value.
|
|
10
|
+
*/
|
|
11
|
+
registerInto(target: McpToolsPort, options: {
|
|
12
|
+
scopeNamespace: string;
|
|
13
|
+
}): void;
|
|
14
|
+
}
|
|
15
|
+
//# sourceMappingURL=mcp-tools.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"mcp-tools.d.ts","sourceRoot":"","sources":["../src/mcp-tools.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,KAAK,YAAY,EAMlB,MAAM,sBAAsB,CAAC;AAG9B,OAAO,EAAE,eAAe,EAAE,MAAM,WAAW,CAAC;AAE5C,eAAO,MAAM,kBAAkB,qEAIrB,CAAC;AAgCX,qBACa,gBAAgB;IACU,OAAO,CAAC,QAAQ,CAAC,QAAQ;gBAAR,QAAQ,EAAE,eAAe;IAC/E;;;OAGG;IACH,YAAY,CAAC,MAAM,EAAE,YAAY,EAAE,OAAO,EAAE;QAAE,cAAc,EAAE,MAAM,CAAA;KAAE;CAkFvE"}
|