@rubics-code/agent-kit 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.
Files changed (79) hide show
  1. package/LICENSE +21 -0
  2. package/README.md +80 -2
  3. package/dist/approval.d.ts +20 -0
  4. package/dist/approval.js +32 -0
  5. package/dist/assemble.d.ts +24 -0
  6. package/dist/assemble.js +19 -0
  7. package/dist/briefing.d.ts +12 -0
  8. package/dist/briefing.js +22 -0
  9. package/dist/capabilities.d.ts +2 -0
  10. package/dist/capabilities.js +6 -0
  11. package/dist/credentials.d.ts +28 -0
  12. package/dist/credentials.js +134 -0
  13. package/dist/errors.d.ts +2 -0
  14. package/dist/errors.js +4 -0
  15. package/dist/group.d.ts +68 -0
  16. package/dist/group.js +89 -0
  17. package/dist/groups/cloudflare/client.d.ts +42 -0
  18. package/dist/groups/cloudflare/client.js +76 -0
  19. package/dist/groups/cloudflare/guidance.md +7 -0
  20. package/dist/groups/cloudflare/memory.d.ts +19 -0
  21. package/dist/groups/cloudflare/memory.js +43 -0
  22. package/dist/groups/cloudflare/tools.d.ts +3 -0
  23. package/dist/groups/cloudflare/tools.js +140 -0
  24. package/dist/groups/infisical/client.d.ts +30 -0
  25. package/dist/groups/infisical/client.js +133 -0
  26. package/dist/groups/infisical/guidance.md +8 -0
  27. package/dist/groups/infisical/memory.d.ts +18 -0
  28. package/dist/groups/infisical/memory.js +43 -0
  29. package/dist/groups/infisical/tools.d.ts +3 -0
  30. package/dist/groups/infisical/tools.js +88 -0
  31. package/dist/groups/mxroute/client.d.ts +90 -0
  32. package/dist/groups/mxroute/client.js +86 -0
  33. package/dist/groups/mxroute/guidance.md +13 -0
  34. package/dist/groups/mxroute/memory.d.ts +34 -0
  35. package/dist/groups/mxroute/memory.js +83 -0
  36. package/dist/groups/mxroute/tools.d.ts +3 -0
  37. package/dist/groups/mxroute/tools.js +158 -0
  38. package/dist/groups/openrouter/client.d.ts +66 -0
  39. package/dist/groups/openrouter/client.js +66 -0
  40. package/dist/groups/openrouter/guidance.md +7 -0
  41. package/dist/groups/openrouter/memory.d.ts +26 -0
  42. package/dist/groups/openrouter/memory.js +59 -0
  43. package/dist/groups/openrouter/tools.d.ts +3 -0
  44. package/dist/groups/openrouter/tools.js +130 -0
  45. package/dist/groups/registrar/client.d.ts +48 -0
  46. package/dist/groups/registrar/client.js +75 -0
  47. package/dist/groups/registrar/guidance.md +9 -0
  48. package/dist/groups/registrar/memory.d.ts +16 -0
  49. package/dist/groups/registrar/memory.js +27 -0
  50. package/dist/groups/registrar/tools.d.ts +4 -0
  51. package/dist/groups/registrar/tools.js +102 -0
  52. package/dist/index.d.ts +35 -0
  53. package/dist/index.js +35 -0
  54. package/dist/policy.d.ts +12 -0
  55. package/dist/policy.js +1 -0
  56. package/dist/result.d.ts +2 -0
  57. package/dist/result.js +17 -0
  58. package/dist/runtime/agent.d.ts +28 -0
  59. package/dist/runtime/agent.js +28 -0
  60. package/dist/runtime/container.d.ts +8 -0
  61. package/dist/runtime/container.js +41 -0
  62. package/dist/runtime/run.d.ts +51 -0
  63. package/dist/runtime/run.js +152 -0
  64. package/dist/runtime/transcribe.d.ts +7 -0
  65. package/dist/runtime/transcribe.js +37 -0
  66. package/dist/runtime/turns.d.ts +13 -0
  67. package/dist/runtime/turns.js +23 -0
  68. package/dist/runtime/web/index.html +452 -0
  69. package/dist/runtime/web/server.d.ts +20 -0
  70. package/dist/runtime/web/server.js +150 -0
  71. package/dist/schemas.d.ts +2 -0
  72. package/dist/schemas.js +6 -0
  73. package/dist/secret-delivery.d.ts +18 -0
  74. package/dist/secret-delivery.js +45 -0
  75. package/dist/secret-store.d.ts +13 -0
  76. package/dist/secret-store.js +1 -0
  77. package/dist/secrets.d.ts +5 -0
  78. package/dist/secrets.js +13 -0
  79. package/package.json +57 -4
@@ -0,0 +1,45 @@
1
+ import { generatePassword } from "./secrets.js";
2
+ import { z } from "zod";
3
+ export const secretName = z
4
+ .string()
5
+ .regex(/^[A-Z][A-Z0-9_]{0,127}$/, "upper case with underscores, for example API_SERVER_KEY")
6
+ .describe("Secret name, upper case with underscores, for example API_SERVER_KEY");
7
+ // The optional storeAt argument, built from the agent's writable-path policy.
8
+ export function storeAtFor(policy) {
9
+ return z
10
+ .object({
11
+ path: policy.infisical.writablePath,
12
+ name: secretName,
13
+ })
14
+ .optional()
15
+ .describe(`Optional. The Infisical folder and name to store the new secret in. Without it, the secret goes to ${policy.operator}'s terminal.`);
16
+ }
17
+ export function placeText(policy, p) {
18
+ return `Infisical ${policy.infisical.envLabel(p.path)} ${p.path}/${p.name}`;
19
+ }
20
+ // The approval text for a write into Infisical: says when it replaces a value or makes a folder.
21
+ export async function describePlace(policy, store, p) {
22
+ const { folderExists, exists } = await store.check(p);
23
+ if (exists)
24
+ return `${placeText(policy, p)} (REPLACES the current value)`;
25
+ return `${placeText(policy, p)} (new${folderExists ? "" : `, makes the folder ${p.path}`})`;
26
+ }
27
+ // Puts a new secret where the operator asked. If Infisical fails after the
28
+ // secret exists, the secret goes to the terminal so that it is not lost.
29
+ export async function deliverSecret(opts, label, value) {
30
+ const where = opts.secrets.where ?? `${opts.policy.operator}'s terminal`;
31
+ if (!opts.place || !opts.store) {
32
+ await opts.secrets.deliver(label, value);
33
+ return `It went directly to ${where}. You do not have it.`;
34
+ }
35
+ try {
36
+ await opts.store.put(opts.place, value);
37
+ return `It is stored in ${placeText(opts.policy, opts.place)}. You do not have it.`;
38
+ }
39
+ catch (err) {
40
+ await opts.secrets.deliver(label, value);
41
+ const why = err instanceof Error ? err.message : String(err);
42
+ return `Storing it in Infisical failed (${why}), so it went to ${where} instead. You do not have it.`;
43
+ }
44
+ }
45
+ export const NO_INFISICAL = "Not done: Infisical is not set up for you, so you cannot use storeAt. Call again without it.";
@@ -0,0 +1,13 @@
1
+ export interface SecretPlace {
2
+ path: string;
3
+ name: string;
4
+ }
5
+ export interface SecretStore {
6
+ listFolders(path: string): Promise<string[]>;
7
+ listSecretNames(path: string): Promise<string[]>;
8
+ check(place: SecretPlace): Promise<{
9
+ folderExists: boolean;
10
+ exists: boolean;
11
+ }>;
12
+ put(place: SecretPlace, value: string): Promise<void>;
13
+ }
@@ -0,0 +1 @@
1
+ export {};
@@ -0,0 +1,5 @@
1
+ export interface SecretSink {
2
+ deliver(label: string, value: string): Promise<void>;
3
+ where?: string;
4
+ }
5
+ export declare function generatePassword(length?: number): string;
@@ -0,0 +1,13 @@
1
+ import { randomInt } from "node:crypto";
2
+ const SETS = ["ABCDEFGHJKLMNPQRSTUVWXYZ", "abcdefghijkmnopqrstuvwxyz", "23456789", "-_.!"];
3
+ const ALL = SETS.join("");
4
+ export function generatePassword(length = 24) {
5
+ const chars = SETS.map((s) => s[randomInt(s.length)]);
6
+ while (chars.length < length)
7
+ chars.push(ALL[randomInt(ALL.length)]);
8
+ for (let i = chars.length - 1; i > 0; i--) {
9
+ const j = randomInt(i + 1);
10
+ [chars[i], chars[j]] = [chars[j], chars[i]];
11
+ }
12
+ return chars.join("");
13
+ }
package/package.json CHANGED
@@ -1,6 +1,59 @@
1
1
  {
2
2
  "name": "@rubics-code/agent-kit",
3
- "version": "0.0.0-stage",
4
- "stub": true,
5
- "description": "Temporary package placeholder for staged publishing"
6
- }
3
+ "version": "0.1.0",
4
+ "description": "Agent machinery: tool groups, an approval gate, secret delivery, Infisical Agent Vault keys, a terminal and web chat, and a container mode.",
5
+ "license": "MIT",
6
+ "author": "Rubics Code",
7
+ "repository": {
8
+ "type": "git",
9
+ "url": "git+https://github.com/rubics-code/agent-kit.git"
10
+ },
11
+ "homepage": "https://github.com/rubics-code/agent-kit#readme",
12
+ "bugs": "https://github.com/rubics-code/agent-kit/issues",
13
+ "keywords": [
14
+ "agent",
15
+ "langchain",
16
+ "langgraph",
17
+ "infisical",
18
+ "agent-vault",
19
+ "tools",
20
+ "approval"
21
+ ],
22
+ "type": "module",
23
+ "engines": {
24
+ "node": ">=24"
25
+ },
26
+ "exports": {
27
+ ".": {
28
+ "types": "./dist/index.d.ts",
29
+ "default": "./dist/index.js"
30
+ }
31
+ },
32
+ "files": [
33
+ "dist",
34
+ "README.md",
35
+ "LICENSE"
36
+ ],
37
+ "publishConfig": {
38
+ "access": "public"
39
+ },
40
+ "scripts": {
41
+ "type-check": "tsc --noEmit",
42
+ "test": "vitest run",
43
+ "build": "node scripts/build.ts",
44
+ "prepack": "node scripts/build.ts",
45
+ "pack-check": "node scripts/pack-check.ts"
46
+ },
47
+ "dependencies": {
48
+ "@langchain/core": "^1.5.1",
49
+ "@langchain/langgraph": "^1.7.5",
50
+ "langchain": "^1.6.8",
51
+ "zod": "^4.6.7",
52
+ "@langchain/openai": "^1.8.5"
53
+ },
54
+ "devDependencies": {
55
+ "@types/node": "^26.6.6",
56
+ "typescript": "^7.0.2",
57
+ "vitest": "^5.1.2"
58
+ }
59
+ }