@action-llama/action-llama 0.13.3 → 0.13.5

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 (163) hide show
  1. package/README.md +6 -6
  2. package/agent-docs/AGENTS.md +1478 -339
  3. package/dist/agents/container-entry.d.ts.map +1 -1
  4. package/dist/agents/container-entry.js +3 -1
  5. package/dist/agents/container-entry.js.map +1 -1
  6. package/dist/agents/execution-engine.d.ts.map +1 -1
  7. package/dist/agents/execution-engine.js +3 -1
  8. package/dist/agents/execution-engine.js.map +1 -1
  9. package/dist/agents/runner.d.ts.map +1 -1
  10. package/dist/agents/runner.js +3 -1
  11. package/dist/agents/runner.js.map +1 -1
  12. package/dist/build-info.json +1 -1
  13. package/dist/cli/commands/chat.js +6 -2
  14. package/dist/cli/commands/chat.js.map +1 -1
  15. package/dist/cli/commands/push.d.ts +1 -0
  16. package/dist/cli/commands/push.d.ts.map +1 -1
  17. package/dist/cli/commands/push.js +22 -4
  18. package/dist/cli/commands/push.js.map +1 -1
  19. package/dist/cli/commands/status.d.ts.map +1 -1
  20. package/dist/cli/commands/status.js +10 -5
  21. package/dist/cli/commands/status.js.map +1 -1
  22. package/dist/cli/main.js +3 -2
  23. package/dist/cli/main.js.map +1 -1
  24. package/dist/cloud/{vps/cloudflare-api.d.ts → cloudflare/api.d.ts} +1 -1
  25. package/dist/cloud/cloudflare/api.d.ts.map +1 -0
  26. package/dist/cloud/{vps/cloudflare-api.js → cloudflare/api.js} +1 -1
  27. package/dist/cloud/cloudflare/api.js.map +1 -0
  28. package/dist/cloud/provider.js +2 -2
  29. package/dist/cloud/provider.js.map +1 -1
  30. package/dist/cloud/vps/provider.d.ts +4 -4
  31. package/dist/cloud/vps/provider.d.ts.map +1 -1
  32. package/dist/cloud/vps/provider.js +4 -4
  33. package/dist/cloud/vps/provider.js.map +1 -1
  34. package/dist/cloud/vps/provision.js +4 -4
  35. package/dist/cloud/vps/provision.js.map +1 -1
  36. package/dist/cloud/vps/teardown.d.ts +2 -2
  37. package/dist/cloud/vps/teardown.d.ts.map +1 -1
  38. package/dist/cloud/vps/teardown.js +3 -3
  39. package/dist/cloud/vps/teardown.js.map +1 -1
  40. package/dist/cloud/vps/verify.js +2 -2
  41. package/dist/cloud/vps/verify.js.map +1 -1
  42. package/dist/credentials/builtins/cloudflare-api-token.js +1 -1
  43. package/dist/credentials/builtins/cloudflare-api-token.js.map +1 -1
  44. package/dist/gateway/auth.d.ts +6 -1
  45. package/dist/gateway/auth.d.ts.map +1 -1
  46. package/dist/gateway/auth.js +21 -4
  47. package/dist/gateway/auth.js.map +1 -1
  48. package/dist/gateway/index.d.ts +1 -0
  49. package/dist/gateway/index.d.ts.map +1 -1
  50. package/dist/gateway/index.js +13 -6
  51. package/dist/gateway/index.js.map +1 -1
  52. package/dist/gateway/lock-store.d.ts +17 -0
  53. package/dist/gateway/lock-store.d.ts.map +1 -1
  54. package/dist/gateway/lock-store.js +101 -28
  55. package/dist/gateway/lock-store.js.map +1 -1
  56. package/dist/gateway/routes/control.d.ts +3 -0
  57. package/dist/gateway/routes/control.d.ts.map +1 -1
  58. package/dist/gateway/routes/control.js +7 -0
  59. package/dist/gateway/routes/control.js.map +1 -1
  60. package/dist/gateway/routes/dashboard.d.ts +6 -1
  61. package/dist/gateway/routes/dashboard.d.ts.map +1 -1
  62. package/dist/gateway/routes/dashboard.js +37 -3
  63. package/dist/gateway/routes/dashboard.js.map +1 -1
  64. package/dist/gateway/routes/locks.d.ts.map +1 -1
  65. package/dist/gateway/routes/locks.js +7 -3
  66. package/dist/gateway/routes/locks.js.map +1 -1
  67. package/dist/gateway/routes/webhooks.d.ts.map +1 -1
  68. package/dist/gateway/routes/webhooks.js +0 -3
  69. package/dist/gateway/routes/webhooks.js.map +1 -1
  70. package/dist/gateway/session-store.d.ts +11 -0
  71. package/dist/gateway/session-store.d.ts.map +1 -0
  72. package/dist/gateway/session-store.js +33 -0
  73. package/dist/gateway/session-store.js.map +1 -0
  74. package/dist/gateway/types.d.ts +5 -0
  75. package/dist/gateway/types.d.ts.map +1 -1
  76. package/dist/remote/push.d.ts +15 -1
  77. package/dist/remote/push.d.ts.map +1 -1
  78. package/dist/remote/push.js +54 -3
  79. package/dist/remote/push.js.map +1 -1
  80. package/dist/scheduler/call-dispatcher.d.ts +11 -0
  81. package/dist/scheduler/call-dispatcher.d.ts.map +1 -0
  82. package/dist/scheduler/call-dispatcher.js +65 -0
  83. package/dist/scheduler/call-dispatcher.js.map +1 -0
  84. package/dist/scheduler/cron-setup.d.ts +41 -0
  85. package/dist/scheduler/cron-setup.d.ts.map +1 -0
  86. package/dist/scheduler/cron-setup.js +94 -0
  87. package/dist/scheduler/cron-setup.js.map +1 -0
  88. package/dist/scheduler/event-queue-sqlite.d.ts +27 -0
  89. package/dist/scheduler/event-queue-sqlite.d.ts.map +1 -0
  90. package/dist/scheduler/event-queue-sqlite.js +105 -0
  91. package/dist/scheduler/event-queue-sqlite.js.map +1 -0
  92. package/dist/scheduler/event-queue.d.ts +31 -9
  93. package/dist/scheduler/event-queue.d.ts.map +1 -1
  94. package/dist/scheduler/event-queue.js +21 -32
  95. package/dist/scheduler/event-queue.js.map +1 -1
  96. package/dist/scheduler/execution.d.ts +9 -2
  97. package/dist/scheduler/execution.d.ts.map +1 -1
  98. package/dist/scheduler/execution.js +64 -48
  99. package/dist/scheduler/execution.js.map +1 -1
  100. package/dist/scheduler/gateway-setup.d.ts +40 -0
  101. package/dist/scheduler/gateway-setup.d.ts.map +1 -0
  102. package/dist/scheduler/gateway-setup.js +135 -0
  103. package/dist/scheduler/gateway-setup.js.map +1 -0
  104. package/dist/scheduler/index.d.ts +4 -7
  105. package/dist/scheduler/index.d.ts.map +1 -1
  106. package/dist/scheduler/index.js +81 -437
  107. package/dist/scheduler/index.js.map +1 -1
  108. package/dist/scheduler/runner-setup.d.ts +34 -0
  109. package/dist/scheduler/runner-setup.d.ts.map +1 -0
  110. package/dist/scheduler/runner-setup.js +63 -0
  111. package/dist/scheduler/runner-setup.js.map +1 -0
  112. package/dist/scheduler/shutdown.d.ts +20 -0
  113. package/dist/scheduler/shutdown.d.ts.map +1 -0
  114. package/dist/scheduler/shutdown.js +38 -0
  115. package/dist/scheduler/shutdown.js.map +1 -0
  116. package/dist/scheduler/state.d.ts +17 -0
  117. package/dist/scheduler/state.d.ts.map +1 -0
  118. package/dist/scheduler/state.js +10 -0
  119. package/dist/scheduler/state.js.map +1 -0
  120. package/dist/scheduler/validation.d.ts +18 -0
  121. package/dist/scheduler/validation.d.ts.map +1 -0
  122. package/dist/scheduler/validation.js +59 -0
  123. package/dist/scheduler/validation.js.map +1 -0
  124. package/dist/scheduler/watcher.d.ts.map +1 -1
  125. package/dist/scheduler/watcher.js +31 -48
  126. package/dist/scheduler/watcher.js.map +1 -1
  127. package/dist/scheduler/webhook-setup.d.ts +18 -1
  128. package/dist/scheduler/webhook-setup.d.ts.map +1 -1
  129. package/dist/scheduler/webhook-setup.js +51 -0
  130. package/dist/scheduler/webhook-setup.js.map +1 -1
  131. package/dist/shared/config.d.ts +2 -3
  132. package/dist/shared/config.d.ts.map +1 -1
  133. package/dist/shared/config.js +0 -15
  134. package/dist/shared/config.js.map +1 -1
  135. package/dist/shared/queue-memory.d.ts +16 -0
  136. package/dist/shared/queue-memory.d.ts.map +1 -0
  137. package/dist/shared/queue-memory.js +28 -0
  138. package/dist/shared/queue-memory.js.map +1 -0
  139. package/dist/shared/queue-sqlite.d.ts +28 -0
  140. package/dist/shared/queue-sqlite.d.ts.map +1 -0
  141. package/dist/shared/queue-sqlite.js +86 -0
  142. package/dist/shared/queue-sqlite.js.map +1 -0
  143. package/dist/shared/queue.d.ts +55 -0
  144. package/dist/shared/queue.d.ts.map +1 -0
  145. package/dist/shared/queue.js +22 -0
  146. package/dist/shared/queue.js.map +1 -0
  147. package/dist/shared/server.d.ts +1 -0
  148. package/dist/shared/server.d.ts.map +1 -1
  149. package/dist/shared/server.js +3 -0
  150. package/dist/shared/server.js.map +1 -1
  151. package/package.json +2 -2
  152. package/agent-docs/skills/README.md +0 -15
  153. package/agent-docs/skills/calls.md +0 -82
  154. package/agent-docs/skills/credentials.md +0 -45
  155. package/agent-docs/skills/environment.md +0 -102
  156. package/agent-docs/skills/resource-locks.md +0 -78
  157. package/agent-docs/skills/signals.md +0 -98
  158. package/dist/cloud/vps/cloudflare-api.d.ts.map +0 -1
  159. package/dist/cloud/vps/cloudflare-api.js.map +0 -1
  160. package/dist/gateway/rate-limiter.d.ts +0 -16
  161. package/dist/gateway/rate-limiter.d.ts.map +0 -1
  162. package/dist/gateway/rate-limiter.js +0 -38
  163. package/dist/gateway/rate-limiter.js.map +0 -1
@@ -1,102 +0,0 @@
1
- # Skill: Environment
2
-
3
- Every run starts with context injected into your prompt. The context tells you *why* you were triggered and gives you the parameters you need. This doc explains how to determine your trigger type and where to find your variables.
4
-
5
- ## Trigger types
6
-
7
- You are triggered in exactly one of four ways. Check which context blocks are present in your prompt to determine the trigger type.
8
-
9
- ### Scheduled run
10
-
11
- **How to detect:** No `<webhook-trigger>` or `<agent-trigger>` block. Your prompt says "You are running on a schedule."
12
-
13
- **What to do:** Check for new work proactively. Query APIs, list issues, scan for alerts — whatever your actions define. If you completed work and there may be more, run `al-rerun`.
14
-
15
- **Where to get context:**
16
- - `<agent-config>` — your custom params (repos, labels, org names, etc.)
17
- - `<credential-context>` — which env vars and tools are available
18
-
19
- ### Webhook run
20
-
21
- **How to detect:** A `<webhook-trigger>` block is present.
22
-
23
- **What to do:** Act on the specific event described in the trigger. You don't need to search for work — the work came to you.
24
-
25
- **Where to get context:**
26
- - `<webhook-trigger>` — the event payload:
27
-
28
- | Field | Type | Description |
29
- |-------|------|-------------|
30
- | `source` | string | Webhook provider (e.g. "github", "sentry") |
31
- | `event` | string | Event type (e.g. "issues", "pull_request", "push") |
32
- | `action` | string? | Event action (e.g. "opened", "labeled", "closed") |
33
- | `repo` | string | Repository in `owner/repo` format |
34
- | `number` | number? | Issue or PR number |
35
- | `title` | string? | Issue or PR title |
36
- | `body` | string? | Issue or PR body |
37
- | `url` | string? | URL to the issue, PR, or commit |
38
- | `author` | string? | Author of the issue/PR |
39
- | `assignee` | string? | Current assignee |
40
- | `labels` | string[]? | Labels on the issue/PR |
41
- | `branch` | string? | Branch name (for push/PR events) |
42
- | `comment` | string? | Comment body (for comment events) |
43
- | `sender` | string | GitHub user who triggered the event |
44
- | `timestamp` | string | ISO 8601 timestamp |
45
-
46
- - `<agent-config>` — your custom params (use to cross-check labels, assignees, etc.)
47
-
48
- ### Agent-triggered run
49
-
50
- **How to detect:** An `<agent-trigger>` block is present.
51
-
52
- **What to do:** Act on the request from the source agent. The trigger context tells you what happened and what's expected.
53
-
54
- **Where to get context:**
55
- - `<agent-trigger>` — the trigger payload:
56
-
57
- | Field | Type | Description |
58
- |-------|------|-------------|
59
- | `source` | string | Name of the agent that triggered you |
60
- | `context` | string | Free-form message from the source agent |
61
-
62
- - `<agent-config>` — your custom params
63
-
64
- ### Manual run
65
-
66
- **How to detect:** No trigger blocks. Your prompt says "You have been triggered manually."
67
-
68
- **What to do:** Same as a scheduled run — check for work proactively.
69
-
70
- ## The `<agent-config>` block
71
-
72
- Always present. Contains the JSON-serialized `[params]` table from your `agent-config.toml`. This is where agent authors put repo names, label names, org identifiers, and anything else the agent needs.
73
-
74
- Example:
75
- ```json
76
- {"repos":["acme/app"],"triggerLabel":"agent","assignee":"bot-user"}
77
- ```
78
-
79
- Your actions should reference these values by name rather than hardcoding them.
80
-
81
- ## The `<credential-context>` block
82
-
83
- Always present. Lists the environment variables and tools available to you based on your mounted credentials. See [Credentials](credentials.md) for the full reference.
84
-
85
- ## Container filesystem
86
-
87
- | Path | Mode | Contents |
88
- |------|------|----------|
89
- | `/app` | read-only | Action Llama application + node_modules |
90
- | `/credentials` | read-only | Mounted credential files |
91
- | `/workspace` | read-write (tmpfs, 2 GB) | Working directory — clone repos here |
92
- | `/tmp` | read-write (tmpfs, 512 MB) | Temporary files |
93
- | `/home/node` | read-write (tmpfs, 64 MB) | User home — `.ssh/` for SSH keys |
94
-
95
- ## Internal env vars
96
-
97
- These are set automatically and used by the `rlock`/`runlock`/`al-shutdown` commands internally. You don't need to reference them directly:
98
-
99
- | Var | Purpose |
100
- |-----|---------|
101
- | `GATEWAY_URL` | Base URL of the scheduler's HTTP gateway |
102
- | `SHUTDOWN_SECRET` | Per-run secret for authenticated API calls |
@@ -1,78 +0,0 @@
1
- # Skill: Resource Locks
2
-
3
- When multiple instances of your agent run in parallel (`scale > 1`), resource locks prevent two instances from working on the same thing (same issue, same PR, same deployment).
4
-
5
- Each lock is identified by a **resource key** — a free-form string you choose.
6
-
7
- ## Commands
8
-
9
- ### `rlock <resourceKey>`
10
-
11
- Acquire an exclusive lock before working on a shared resource.
12
-
13
- ```
14
- rlock "github issue acme/app#42"
15
- ```
16
-
17
- **Responses:**
18
- - Acquired: `{"ok":true}` (exit 0)
19
- - Conflict: `{"ok":false,"holder":"<other-agent>","heldSince":...}` (exit 1) — another instance has it. Skip this resource.
20
- - Already holding another lock: `{"ok":false,"reason":"already holding lock on ..."}` (exit 1) — release your current lock first.
21
-
22
- **Exit codes:** 0=acquired, 1=conflict, 3=auth error, 9=missing arg, 6=unreachable, 7=unexpected — see [exit code table](../AGENTS.md#shell-command-exit-codes)
23
-
24
- ### `runlock <resourceKey>`
25
-
26
- Release a lock when you're done with the resource.
27
-
28
- ```
29
- runlock "github issue acme/app#42"
30
- ```
31
-
32
- **Response:** `{"ok":true}` (exit 0)
33
-
34
- **Exit codes:** 0=released, 1=conflict (held by another), 2=not found, 3=auth error, 9=missing arg, 6=unreachable, 7=unexpected — see [exit code table](../AGENTS.md#shell-command-exit-codes)
35
-
36
- ### `rlock-heartbeat <resourceKey>`
37
-
38
- Extend the TTL on a lock you hold. Use during long-running work to prevent expiry.
39
-
40
- ```
41
- rlock-heartbeat "github issue acme/app#42"
42
- ```
43
-
44
- **Response:** `{"ok":true,"expiresAt":...}` (exit 0)
45
-
46
- **Exit codes:** 0=extended, 1=conflict (held by another), 2=not found, 3=auth error, 9=missing arg, 6=unreachable, 7=unexpected — see [exit code table](../AGENTS.md#shell-command-exit-codes)
47
-
48
- ## Resource key conventions
49
-
50
- Use descriptive, unique keys that identify the exact resource:
51
-
52
- | Pattern | Example |
53
- |---------|---------|
54
- | `github issue owner/repo#number` | `rlock "github issue acme/app#42"` |
55
- | `github pr owner/repo#number` | `rlock "github pr acme/app#17"` |
56
- | `deploy service-name` | `rlock "deploy api-prod"` |
57
-
58
- ## Rules
59
-
60
- - **One lock at a time.** You can hold at most one lock. `runlock` before acquiring a different resource.
61
- - **Always `rlock` before starting work** on a shared resource (issues, PRs, deployments).
62
- - **Always `runlock` when done.** Locks are auto-released when your container exits, but explicit unlock is cleaner.
63
- - **If `rlock` exits non-zero (or returns `{"ok":false,...}`), skip that resource.** Do not wait, retry, or proceed without the lock — move on to the next item.
64
- - **Use `rlock-heartbeat` during long operations** to keep the lock alive. Each heartbeat resets the TTL.
65
- - **Locks expire after 30 minutes** by default (configurable via `gateway.lockTimeout` in `config.toml`). If you don't heartbeat and the lock expires, another instance can claim it.
66
- - When `GATEWAY_URL` is not set (single-instance mode), lock commands return `{"ok":true}` as a no-op (exit 0). When `GATEWAY_URL` is set but the gateway is unreachable, lock commands exit 6 — you must not proceed.
67
-
68
- ## Example workflow
69
-
70
- ```
71
- 1. List open issues labeled "agent"
72
- 2. For each issue:
73
- - rlock "github issue acme/app#42"
74
- - If ok is false, skip — another instance is handling it
75
- - Clone, branch, implement, push, open PR
76
- - runlock "github issue acme/app#42"
77
- 3. If you completed work and there may be more issues, run `al-rerun`
78
- ```
@@ -1,98 +0,0 @@
1
- # Skill: Signals
2
-
3
- Use signal commands to communicate with the scheduler and trigger actions. These commands write signal files to `$AL_SIGNAL_DIR` and optionally POST to the gateway for real-time TUI updates.
4
-
5
- ## Commands
6
-
7
- **`al-rerun`** — Request an immediate rerun after completing work.
8
-
9
- ```
10
- al-rerun
11
- ```
12
-
13
- **When to use:** When you completed work (e.g. processed an issue, merged a PR) and there may be additional items in the backlog. The scheduler will immediately re-run you (up to `maxReruns` times) to drain remaining work.
14
-
15
- **When NOT to use:** If you found no work to do, or if you completed work but the backlog is empty. Simply end without calling `al-rerun` and the scheduler will wait for the next scheduled run.
16
-
17
- **Default behavior:** Without `al-rerun`, the scheduler treats your run as complete and does not rerun. This is the safe default — errors, rate limits, and empty runs won't trigger unwanted reruns.
18
-
19
- ## `al-status "<text>"`
20
-
21
- Updates your status displayed in the TUI and logs. Exits 4 if no text argument is provided.
22
-
23
- ```
24
- al-status "reviewing PR #42"
25
- al-status "deploying api-prod"
26
- al-status "waiting for CI checks"
27
- ```
28
-
29
- **When to use:** At natural milestones during your work — starting a new phase, switching tasks, or waiting on something. Helps the operator see what you're doing in real time.
30
-
31
- **Format:** Provide the status text as a quoted argument. Keep it short and descriptive.
32
-
33
- ## `al-return`
34
-
35
- Returns a value to the calling agent when you were invoked via `al-call`.
36
-
37
- ```
38
- al-return "PR looks good. Approved with minor suggestions."
39
- ```
40
-
41
- For multiline results, pipe via stdin:
42
-
43
- ```
44
- cat <<'EOF' | al-return
45
- PR looks good. Approved with minor suggestions:
46
- - Line 42: consider using a const instead of let
47
- - Line 89: missing error handling for the API call
48
- EOF
49
- ```
50
-
51
- **When to use:** When you were called by another agent (you'll see an `<agent-call>` block in your prompt) and need to send back a result. Pass your return value as an argument or pipe it via stdin.
52
-
53
- **Rules:**
54
- - If you call `al-return` multiple times, the last value wins
55
- - If you were not called by another agent, `al-return` is a no-op
56
- - Call chains are bounded by `maxCallDepth` (default: 3) to prevent infinite loops
57
-
58
- ## `al-exit [code]`
59
-
60
- Terminates the agent with an optional exit code, indicating an unrecoverable error or intentional abort.
61
-
62
- ```
63
- al-exit 10 # GitHub token is invalid or expired
64
- al-exit 11 # Permission denied accessing repository
65
- al-exit 15 # Unrecoverable error in build system
66
- al-exit # Defaults to 15 (unrecoverable error)
67
- ```
68
-
69
- **When to use:** When encountering errors that cannot be resolved by retrying — authentication failures, permission issues, invalid configuration, or when you need to abort due to user request or safety concerns.
70
-
71
- **Format:** Pass the exit code as an argument, or omit for code 15 (unrecoverable error).
72
-
73
- **Standard exit codes:**
74
- - `10` — Authentication/credentials failure
75
- - `11` — Permission/access denied
76
- - `12` — Rate limit exceeded
77
- - `13` — Configuration error
78
- - `14` — Missing dependency or service error
79
- - `15` — Generic unrecoverable error (default)
80
- - `16` — User-requested abort
81
-
82
- **Behavior:** The agent terminates with the specified exit code. The scheduler will not retry automatically.
83
-
84
- **When NOT to use:** For transient errors (network timeouts, temporary rate limits) or normal completion. Use normal error handling or simply complete the run instead.
85
-
86
- ## Responses
87
-
88
- All signal commands return JSON responses:
89
- - Success: `{"ok":true}`
90
- - Error: `{"ok":false,"error":"<message>"}`
91
-
92
- ## Multiple signals
93
-
94
- You can use multiple signal commands in one run. For example, you might run several `al-status` updates as you work, then `al-return` with your result, and `al-rerun` if there's more work to do.
95
-
96
- ## Graceful degradation
97
-
98
- Commands gracefully degrade when `GATEWAY_URL` is not set — signal files are always written, but real-time TUI updates only work when a gateway is available. This allows agents to work in both containerized and host environments.
@@ -1 +0,0 @@
1
- {"version":3,"file":"cloudflare-api.d.ts","sourceRoot":"","sources":["../../../src/cloud/vps/cloudflare-api.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAYH,MAAM,WAAW,cAAc;IAC7B,EAAE,EAAE,MAAM,CAAC;IACX,IAAI,EAAE,MAAM,CAAC;IACb,MAAM,EAAE,MAAM,CAAC;CAChB;AAED,MAAM,WAAW,mBAAmB;IAClC,EAAE,EAAE,MAAM,CAAC;IACX,IAAI,EAAE,MAAM,CAAC;IACb,IAAI,EAAE,MAAM,CAAC;IACb,OAAO,EAAE,MAAM,CAAC;IAChB,OAAO,EAAE,OAAO,CAAC;IACjB,GAAG,EAAE,MAAM,CAAC;CACb;AAED,MAAM,WAAW,2BAA2B;IAC1C,EAAE,EAAE,MAAM,CAAC;IACX,WAAW,EAAE,MAAM,CAAC;IACpB,WAAW,EAAE,M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OAAO,CACxB,KAAK,EACL,EAAE,EACF;QACE,MAAM,EAAE,MAAM;QACd,IAAI,EAAE,IAAI,CAAC,SAAS,CAAC;YACnB,SAAS;YACT,kBAAkB,EAAE,YAAY;YAChC,YAAY,EAAE,YAAY;YAC1B,GAAG;SACJ,CAAC;KACH,EACD,aAAa,CACd,CAAC;IACF,OAAO,EAAE,GAAG,IAAI,CAAC,MAAM,EAAE,WAAW,EAAE,GAAG,EAAE,CAAC;AAC9C,CAAC;AAED;;GAEG;AACH,MAAM,CAAC,KAAK,UAAU,UAAU,CAAC,KAAa,EAAE,MAAc;IAC5D,MAAM,IAAI,GAAG,MAAM,OAAO,CAAC,KAAK,EAAE,UAAU,MAAM,eAAe,CAAC,CAAC;IACnE,OAAO,IAAI,CAAC,MAAM,CAAC,KAAK,CAAC;AAC3B,CAAC;AAED;;;GAGG;AACH,MAAM,CAAC,KAAK,UAAU,UAAU,CAC9B,KAAa,EACb,MAAc,EACd,IAA4C;IAE5C,MAAM,OAAO,CAAC,KAAK,EAAE,UAAU,MAAM,eAAe,EAAE;QACpD,MAAM,EAAE,OAAO;QACf,IAAI,EAAE,IAAI,CAAC,SAAS,CAAC,EAAE,KAAK,EAAE,IAAI,EAAE,CAAC;KACtC,CAAC,CAAC;AACL,CAAC"}
@@ -1,16 +0,0 @@
1
- import type { Context, Next } from "hono";
2
- interface RateLimiterOpts {
3
- /** Maximum requests per window */
4
- max: number;
5
- /** Window size in milliseconds */
6
- windowMs: number;
7
- }
8
- /**
9
- * Simple in-memory sliding-window rate limiter keyed by IP.
10
- * Designed for single-process use (local scheduler or cloud scheduler instance).
11
- */
12
- export declare function rateLimiter(opts: RateLimiterOpts): (c: Context, next: Next) => Promise<(Response & import("hono").TypedResponse<{
13
- error: string;
14
- }, 429, "json">) | undefined>;
15
- export {};
16
- //# sourceMappingURL=rate-limiter.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"rate-limiter.d.ts","sourceRoot":"","sources":["../../src/gateway/rate-limiter.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,OAAO,EAAE,IAAI,EAAE,MAAM,MAAM,CAAC;AAE1C,UAAU,eAAe;IACvB,kCAAkC;IAClC,GAAG,EAAE,MAAM,CAAC;IACZ,kCAAkC;IAClC,QAAQ,EAAE,MAAM,CAAC;CAClB;AAED;;;GAGG;AACH,wBAAgB,WAAW,CAAC,IAAI,EAAE,eAAe,IAiBjC,GAAG,OAAO,EAAE,MAAM,IAAI;;8BAkBrC"}
@@ -1,38 +0,0 @@
1
- /**
2
- * Simple in-memory sliding-window rate limiter keyed by IP.
3
- * Designed for single-process use (local scheduler or cloud scheduler instance).
4
- */
5
- export function rateLimiter(opts) {
6
- const hits = new Map();
7
- // Periodically clean up old entries to prevent unbounded growth
8
- const cleanup = setInterval(() => {
9
- const cutoff = Date.now() - opts.windowMs;
10
- for (const [key, timestamps] of hits) {
11
- const filtered = timestamps.filter((t) => t > cutoff);
12
- if (filtered.length === 0) {
13
- hits.delete(key);
14
- }
15
- else {
16
- hits.set(key, filtered);
17
- }
18
- }
19
- }, opts.windowMs);
20
- if (cleanup.unref)
21
- cleanup.unref();
22
- return async (c, next) => {
23
- const ip = c.req.header("x-forwarded-for")?.split(",")[0]?.trim()
24
- || c.req.header("x-real-ip")
25
- || "unknown";
26
- const now = Date.now();
27
- const cutoff = now - opts.windowMs;
28
- const timestamps = (hits.get(ip) || []).filter((t) => t > cutoff);
29
- if (timestamps.length >= opts.max) {
30
- c.header("Retry-After", String(Math.ceil(opts.windowMs / 1000)));
31
- return c.json({ error: "too many requests" }, 429);
32
- }
33
- timestamps.push(now);
34
- hits.set(ip, timestamps);
35
- await next();
36
- };
37
- }
38
- //# sourceMappingURL=rate-limiter.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"rate-limiter.js","sourceRoot":"","sources":["../../src/gateway/rate-limiter.ts"],"names":[],"mappings":"AASA;;;GAGG;AACH,MAAM,UAAU,WAAW,CAAC,IAAqB;IAC/C,MAAM,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