nowaikit 4.19.0 → 4.20.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/desktop/renderer/dist/assets/index-DSLAKhIs.js +55 -0
- package/desktop/renderer/dist/index.html +1 -1
- package/desktop/serve.cjs +161 -0
- package/dist/server.d.ts.map +1 -1
- package/dist/server.js +11 -2
- package/dist/server.js.map +1 -1
- package/dist/servicenow/client.d.ts.map +1 -1
- package/dist/servicenow/client.js +9 -1
- package/dist/servicenow/client.js.map +1 -1
- package/dist/servicenow/instances.js +1 -1
- package/dist/utils/request-context.d.ts +19 -1
- package/dist/utils/request-context.d.ts.map +1 -1
- package/dist/utils/request-context.js +33 -2
- package/dist/utils/request-context.js.map +1 -1
- package/package.json +1 -1
- package/desktop/renderer/dist/assets/index-DIXajM0H.js +0 -55
|
@@ -14,9 +14,40 @@
|
|
|
14
14
|
import { AsyncLocalStorage } from 'node:async_hooks';
|
|
15
15
|
import { timingSafeEqual } from 'node:crypto';
|
|
16
16
|
const store = new AsyncLocalStorage();
|
|
17
|
-
/** True when delegated-auth mode is switched on. */
|
|
17
|
+
/** True when delegated-auth mode is switched on (`DELEGATED_AUTH=true` or `=strict`). */
|
|
18
18
|
export function isDelegatedAuthEnabled() {
|
|
19
|
-
return process.env.DELEGATED_AUTH === 'true';
|
|
19
|
+
return process.env.DELEGATED_AUTH === 'true' || process.env.DELEGATED_AUTH === 'strict';
|
|
20
|
+
}
|
|
21
|
+
/**
|
|
22
|
+
* Strict delegation: every tool call MUST carry a valid delegated token (which is only present when
|
|
23
|
+
* the gateway secret matched), the request is rejected before any tool runs otherwise, and the server
|
|
24
|
+
* never falls back to base credentials. Enabled with `DELEGATED_AUTH=strict` or
|
|
25
|
+
* `NOWAIKIT_REQUIRE_DELEGATION=true`. This is the supported mode for backend-managed per-user OAuth.
|
|
26
|
+
*/
|
|
27
|
+
export function isDelegationRequired() {
|
|
28
|
+
return process.env.DELEGATED_AUTH === 'strict' || process.env.NOWAIKIT_REQUIRE_DELEGATION === 'true';
|
|
29
|
+
}
|
|
30
|
+
/**
|
|
31
|
+
* Tools that resolve a client directly from the instance manager (server-configured instances) rather
|
|
32
|
+
* than the per-request delegated identity, so they bypass delegation and are refused under strict mode.
|
|
33
|
+
*/
|
|
34
|
+
export const DELEGATION_INSTANCE_SCOPED_TOOLS = new Set([
|
|
35
|
+
'compare_instances', 'switch_instance', 'get_current_instance', 'list_instances',
|
|
36
|
+
]);
|
|
37
|
+
/**
|
|
38
|
+
* Decide whether strict delegated-auth blocks this tool call. Returns an error code to reject with, or
|
|
39
|
+
* null to allow. Reads the current async delegated context, so it must be called inside the request's
|
|
40
|
+
* runWithDelegatedAuth scope. No-op (null) unless strict mode is on.
|
|
41
|
+
*/
|
|
42
|
+
export function strictDelegationViolation(toolName) {
|
|
43
|
+
if (!isDelegationRequired())
|
|
44
|
+
return null;
|
|
45
|
+
const ctx = getDelegatedAuth();
|
|
46
|
+
if (!ctx?.bearerToken)
|
|
47
|
+
return 'DELEGATION_REQUIRED';
|
|
48
|
+
if (DELEGATION_INSTANCE_SCOPED_TOOLS.has(toolName))
|
|
49
|
+
return 'DELEGATION_INCOMPATIBLE_TOOL';
|
|
50
|
+
return null;
|
|
20
51
|
}
|
|
21
52
|
/** Run `fn` with the given delegated-auth context bound for its async lifetime. */
|
|
22
53
|
export function runWithDelegatedAuth(ctx, fn) {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"request-context.js","sourceRoot":"","sources":["../../src/utils/request-context.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;GAYG;AACH,OAAO,EAAE,iBAAiB,EAAE,MAAM,kBAAkB,CAAC;AACrD,OAAO,EAAE,eAAe,EAAE,MAAM,aAAa,CAAC;AAuB9C,MAAM,KAAK,GAAG,IAAI,iBAAiB,EAAiB,CAAC;AAErD,
|
|
1
|
+
{"version":3,"file":"request-context.js","sourceRoot":"","sources":["../../src/utils/request-context.ts"],"names":[],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,KAAK,EAAE,IAAI,CAAC,0BAA0B,CAAC;YACvC,SAAS,EAAE,IAAI,CAAC,+BAA+B,CAAC;YAChD,SAAS,EAAE,IAAI,CAAC,8BAA8B,CAAC;YAC/C,GAAG,EAAE,IAAI,CAAC,wBAAwB,CAAC;YACnC,SAAS,EAAE,IAAI,CAAC,+BAA+B,CAAC;SACjD;KACF,CAAC;AACJ,CAAC"}
|
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "nowaikit",
|
|
3
3
|
"mcpName": "io.github.aartiq/nowaikit",
|
|
4
|
-
"version": "4.
|
|
4
|
+
"version": "4.20.0",
|
|
5
5
|
"description": "The most comprehensive ServiceNow AI toolkit, including a full ServiceNow MCP server: 500+ MCP tools plus 26 AI capabilities (scan, review, build, ops, docs) and a direct BYOK mode. Works with Claude, ChatGPT, Gemini, Cursor, GitHub Copilot and any LLM.",
|
|
6
6
|
"main": "dist/server.js",
|
|
7
7
|
"types": "dist/server.d.ts",
|