@solongate/proxy 0.48.0 → 0.49.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.
Files changed (79) hide show
  1. package/dist/audit/checks/asi01-goal-hijacking.d.ts +2 -0
  2. package/dist/audit/checks/asi02-tool-misuse.d.ts +2 -0
  3. package/dist/audit/checks/asi03-identity-abuse.d.ts +2 -0
  4. package/dist/audit/checks/asi04-supply-chain.d.ts +2 -0
  5. package/dist/audit/checks/asi05-code-execution.d.ts +2 -0
  6. package/dist/audit/checks/asi06-memory-poisoning.d.ts +2 -0
  7. package/dist/audit/checks/asi07-inter-agent.d.ts +2 -0
  8. package/dist/audit/checks/asi08-cascading-failures.d.ts +2 -0
  9. package/dist/audit/checks/asi09-human-trust.d.ts +2 -0
  10. package/dist/audit/checks/asi10-rogue-agents.d.ts +2 -0
  11. package/dist/audit/checks/baseline.d.ts +7 -0
  12. package/dist/audit/checks/chain-analysis.d.ts +2 -0
  13. package/dist/audit/checks/data-flow.d.ts +2 -0
  14. package/dist/audit/checks/index.d.ts +2 -0
  15. package/dist/audit/collector.d.ts +2 -0
  16. package/dist/audit/config.d.ts +9 -0
  17. package/dist/audit/export.d.ts +12 -0
  18. package/dist/audit/index.d.ts +2 -0
  19. package/dist/audit/index.js +3426 -0
  20. package/dist/audit/reporter.d.ts +22 -0
  21. package/dist/audit/spinner.d.ts +10 -0
  22. package/dist/audit/types.d.ts +105 -0
  23. package/dist/cli-utils.d.ts +27 -0
  24. package/dist/config.d.ts +105 -0
  25. package/dist/core/capability-token.d.ts +46 -0
  26. package/dist/core/constants.d.ts +47 -0
  27. package/dist/core/context-boundary.d.ts +19 -0
  28. package/dist/core/context.d.ts +24 -0
  29. package/dist/core/errors.d.ts +51 -0
  30. package/dist/core/execution.d.ts +35 -0
  31. package/dist/core/index.d.ts +14 -0
  32. package/dist/core/input-guard.d.ts +66 -0
  33. package/dist/core/mcp-types.d.ts +35 -0
  34. package/dist/core/permissions.d.ts +27 -0
  35. package/dist/core/policy.d.ts +399 -0
  36. package/dist/core/response-scanner.d.ts +27 -0
  37. package/dist/core/schema-validator.d.ts +33 -0
  38. package/dist/core/tool.d.ts +23 -0
  39. package/dist/core/trust.d.ts +28 -0
  40. package/dist/create.d.ts +13 -0
  41. package/dist/global-install.d.ts +17 -0
  42. package/dist/index.d.ts +38 -0
  43. package/dist/index.js +211 -158
  44. package/dist/init.d.ts +18 -0
  45. package/dist/inject.d.ts +19 -0
  46. package/dist/lib.d.ts +18 -0
  47. package/dist/lib.js +103 -48
  48. package/dist/login.d.ts +2 -0
  49. package/dist/policy-engine/command-matcher.d.ts +34 -0
  50. package/dist/policy-engine/defaults.d.ts +23 -0
  51. package/dist/policy-engine/engine.d.ts +30 -0
  52. package/dist/policy-engine/evaluator.d.ts +13 -0
  53. package/dist/policy-engine/filename-matcher.d.ts +20 -0
  54. package/dist/policy-engine/index.d.ts +12 -0
  55. package/dist/policy-engine/matcher.d.ts +18 -0
  56. package/dist/policy-engine/opa/index.d.ts +4 -0
  57. package/dist/policy-engine/opa/json-to-rego.d.ts +2 -0
  58. package/dist/policy-engine/opa/opa-evaluator.d.ts +10 -0
  59. package/dist/policy-engine/opa/rego-compiler.d.ts +2 -0
  60. package/dist/policy-engine/opa/request-adapter.d.ts +17 -0
  61. package/dist/policy-engine/path-matcher.d.ts +41 -0
  62. package/dist/policy-engine/policy-store.d.ts +66 -0
  63. package/dist/policy-engine/url-matcher.d.ts +29 -0
  64. package/dist/policy-engine/validator.d.ts +7 -0
  65. package/dist/policy-engine/warnings.d.ts +10 -0
  66. package/dist/proxy.d.ts +89 -0
  67. package/dist/pull-push.d.ts +17 -0
  68. package/dist/sdk/config.d.ts +26 -0
  69. package/dist/sdk/expiring-set.d.ts +18 -0
  70. package/dist/sdk/index.d.ts +10 -0
  71. package/dist/sdk/interceptor.d.ts +45 -0
  72. package/dist/sdk/logger.d.ts +16 -0
  73. package/dist/sdk/rate-limiter.d.ts +59 -0
  74. package/dist/sdk/secure-server.d.ts +68 -0
  75. package/dist/sdk/server-verifier.d.ts +53 -0
  76. package/dist/sdk/solongate.d.ts +105 -0
  77. package/dist/sdk/token-issuer.d.ts +37 -0
  78. package/dist/sync.d.ts +82 -0
  79. package/package.json +8 -4
package/dist/sync.d.ts ADDED
@@ -0,0 +1,82 @@
1
+ import type { PolicySet } from './core/index.js';
2
+ export interface PolicySyncOptions {
3
+ /** Absolute path to local policy JSON file (null if cloud-only) */
4
+ localPath: string | null;
5
+ /** SolonGate API key */
6
+ apiKey: string;
7
+ /** SolonGate API URL */
8
+ apiUrl: string;
9
+ /** Polling interval in ms (default: 60000) */
10
+ pollIntervalMs?: number;
11
+ /** Called when policy is updated from either source */
12
+ onPolicyUpdate: (policy: PolicySet) => void;
13
+ /** Initial policy (the currently loaded one) */
14
+ initialPolicy: PolicySet;
15
+ /** Cloud policy ID — determines which cloud policy to push/pull */
16
+ policyId?: string;
17
+ }
18
+ /**
19
+ * Bidirectional policy sync between local JSON file and SolonGate Cloud.
20
+ *
21
+ * - Watches local file for changes → pushes to cloud API (using policyId from CLI)
22
+ * - Polls cloud API for changes → writes to local file
23
+ * - Version number determines which is newer (higher wins)
24
+ * - Loop prevention: skipNextWatch flag when writing to file
25
+ */
26
+ export declare class PolicySyncManager {
27
+ private localPath;
28
+ private apiKey;
29
+ private apiUrl;
30
+ private pollIntervalMs;
31
+ private onPolicyUpdate;
32
+ private currentPolicy;
33
+ private localVersion;
34
+ private cloudVersion;
35
+ private lastWriteTime;
36
+ private debounceTimer;
37
+ private pollTimer;
38
+ private watcher;
39
+ private isLiveKey;
40
+ /** The cloud policy ID from --policy-id flag. This is the ONLY source of truth for which cloud policy to use. */
41
+ private policyId?;
42
+ constructor(opts: PolicySyncOptions);
43
+ /**
44
+ * Start watching local file and polling cloud.
45
+ */
46
+ start(): void;
47
+ /**
48
+ * Stop all watchers and timers.
49
+ */
50
+ stop(): void;
51
+ /**
52
+ * Watch local file for changes (debounced).
53
+ */
54
+ private startFileWatcher;
55
+ /**
56
+ * Handle local file change event.
57
+ */
58
+ private onFileChange;
59
+ /**
60
+ * Poll cloud for policy changes.
61
+ */
62
+ private startPolling;
63
+ /**
64
+ * Handle poll tick — fetch cloud policy and compare.
65
+ */
66
+ private onPollTick;
67
+ /**
68
+ * Push policy to cloud API.
69
+ * Uses this.policyId (from --policy-id CLI flag) as the cloud policy ID.
70
+ * Falls back to policy.id from local file only if --policy-id was not set.
71
+ */
72
+ private pushToCloud;
73
+ /**
74
+ * Write policy to local file (with loop prevention).
75
+ * Does NOT write the 'id' field — cloud ID is managed by --policy-id flag.
76
+ */
77
+ private writeToFile;
78
+ /**
79
+ * Compare two policies by rules content (ignoring timestamps and id).
80
+ */
81
+ private policiesEqual;
82
+ }
package/package.json CHANGED
@@ -1,20 +1,24 @@
1
1
  {
2
2
  "name": "@solongate/proxy",
3
- "version": "0.48.0",
3
+ "version": "0.49.0",
4
4
  "description": "AI tool security proxy — protect any AI tool server with customizable policies, path/command constraints, rate limiting, and audit logging. Zero code changes required.",
5
5
  "type": "module",
6
6
  "bin": {
7
7
  "solongate": "./dist/index.js",
8
8
  "solongate-proxy": "./dist/index.js",
9
9
  "solongate-init": "./dist/init.js",
10
+ "solongate-audit": "./dist/audit/index.js",
10
11
  "proxy": "./dist/index.js"
11
12
  },
12
13
  "main": "./dist/lib.js",
14
+ "types": "./dist/lib.d.ts",
13
15
  "exports": {
14
16
  ".": {
17
+ "types": "./dist/lib.d.ts",
15
18
  "import": "./dist/lib.js"
16
19
  },
17
20
  "./cli": {
21
+ "types": "./dist/index.d.ts",
18
22
  "import": "./dist/index.js"
19
23
  }
20
24
  },
@@ -58,16 +62,16 @@
58
62
  },
59
63
  "devDependencies": {
60
64
  "@open-policy-agent/opa-wasm": "^1.10.0",
65
+ "chalk": "^5.3.0",
61
66
  "esbuild": "^0.19.12",
62
67
  "tsup": "^8.3.0",
63
68
  "tsx": "^4.19.0",
64
69
  "typescript": "^5.7.0",
65
- "@solongate/core": "0.5.0",
66
- "@solongate/policy-engine": "0.3.1",
67
70
  "@solongate/tsconfig": "0.0.0"
68
71
  },
69
72
  "scripts": {
70
- "build": "tsup && pnpm build:hooks",
73
+ "build": "tsup && pnpm build:types && pnpm build:hooks",
74
+ "build:types": "node scripts/build-types.mjs",
71
75
  "build:hooks": "node scripts/bundle-hooks.mjs",
72
76
  "dev": "tsx src/index.ts",
73
77
  "typecheck": "tsc --noEmit",