openloops 0.3.4 → 0.4.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/README.md +9 -8
- package/dist/clients/llm/llm-client.js +6 -5
- package/dist/clients/llm/llm-client.mjs +6 -5
- package/dist/clients/llm/llm-types.d.ts +3 -0
- package/dist/clients/llm/llm-types.js +15 -0
- package/dist/clients/llm/llm-types.mjs +7 -0
- package/dist/db/index.d.ts +1 -0
- package/dist/db/index.js +3 -1
- package/dist/db/index.mjs +1 -0
- package/dist/db/indexes/automation-runs.d.ts +2 -0
- package/dist/db/indexes/automation-runs.js +33 -0
- package/dist/db/indexes/automation-runs.mjs +10 -0
- package/dist/db/indexes/automations.d.ts +2 -0
- package/dist/db/indexes/{agentic-jobs.js → automations.js} +6 -6
- package/dist/db/indexes/{agentic-jobs.mjs → automations.mjs} +2 -2
- package/dist/db/indexes/index.js +6 -4
- package/dist/db/indexes/index.mjs +6 -4
- package/dist/db/indexes/revoked-tokens.d.ts +2 -0
- package/dist/db/indexes/{agentic-job-runs.js → revoked-tokens.js} +8 -9
- package/dist/db/indexes/revoked-tokens.mjs +8 -0
- package/dist/db/migrations/automations.d.ts +12 -0
- package/dist/db/migrations/automations.js +70 -0
- package/dist/db/migrations/automations.mjs +47 -0
- package/dist/harness/agent-loop.d.ts +2 -0
- package/dist/harness/agent.d.ts +1 -0
- package/dist/harness/agent.js +8 -0
- package/dist/harness/agent.mjs +8 -0
- package/dist/loops/agi/loop.js +2 -1
- package/dist/loops/agi/loop.mjs +2 -1
- package/dist/loops/agi/skills/reasoning-engine.js +3 -2
- package/dist/loops/agi/skills/reasoning-engine.mjs +3 -2
- package/dist/loops/shared/skills/fast-responder.js +2 -2
- package/dist/loops/shared/skills/fast-responder.mjs +2 -2
- package/dist/services/authentication/entities/index.d.ts +1 -0
- package/dist/services/authentication/entities/index.js +22 -0
- package/dist/services/authentication/entities/index.mjs +1 -0
- package/dist/services/authentication/entities/revoked-token.entity.d.ts +17 -0
- package/dist/services/authentication/entities/revoked-token.entity.js +67 -0
- package/dist/services/authentication/entities/revoked-token.entity.mjs +44 -0
- package/dist/services/authentication/index.d.ts +1 -0
- package/dist/services/authentication/index.js +3 -1
- package/dist/services/authentication/index.mjs +1 -0
- package/dist/services/authentication/module.d.ts +4 -0
- package/dist/services/authentication/module.js +16 -2
- package/dist/services/authentication/module.mjs +13 -1
- package/dist/services/authentication/repositories/index.d.ts +1 -0
- package/dist/services/{agentic-jobs → authentication}/repositories/index.js +2 -4
- package/dist/services/authentication/repositories/index.mjs +1 -0
- package/dist/services/authentication/repositories/revoked-token.repository.d.ts +7 -0
- package/dist/services/authentication/repositories/revoked-token.repository.js +55 -0
- package/dist/services/authentication/repositories/revoked-token.repository.mjs +26 -0
- package/dist/services/authentication/use-cases/is-token-revoked.use-case.d.ts +15 -0
- package/dist/services/authentication/use-cases/is-token-revoked.use-case.js +55 -0
- package/dist/services/authentication/use-cases/is-token-revoked.use-case.mjs +26 -0
- package/dist/services/authentication/use-cases/revoke-token.use-case.d.ts +14 -0
- package/dist/services/authentication/use-cases/revoke-token.use-case.js +65 -0
- package/dist/services/authentication/use-cases/revoke-token.use-case.mjs +36 -0
- package/dist/services/automations/entities/automation-run.entity.d.ts +46 -0
- package/dist/services/{agentic-jobs/entities/agentic-job-run.entity.js → automations/entities/automation-run.entity.js} +22 -14
- package/dist/services/{agentic-jobs/entities/agentic-job-run.entity.mjs → automations/entities/automation-run.entity.mjs} +18 -10
- package/dist/services/automations/entities/automation.entity.d.ts +38 -0
- package/dist/services/{agentic-jobs/entities/agentic-job.entity.js → automations/entities/automation.entity.js} +17 -17
- package/dist/services/{agentic-jobs/entities/agentic-job.entity.mjs → automations/entities/automation.entity.mjs} +13 -13
- package/dist/services/automations/entities/index.d.ts +4 -0
- package/dist/services/{agentic-jobs → automations}/entities/index.js +6 -4
- package/dist/services/automations/entities/index.mjs +4 -0
- package/dist/services/automations/entities/trigger.d.ts +11 -0
- package/dist/services/automations/entities/trigger.js +49 -0
- package/dist/services/automations/entities/trigger.mjs +26 -0
- package/dist/services/automations/index.d.ts +5 -0
- package/dist/services/{agentic-jobs → automations}/index.js +9 -7
- package/dist/services/automations/index.mjs +5 -0
- package/dist/services/automations/module.d.ts +41 -0
- package/dist/services/automations/module.js +167 -0
- package/dist/services/automations/module.mjs +125 -0
- package/dist/services/automations/repositories/automation-run.repository.d.ts +14 -0
- package/dist/services/{agentic-jobs/repositories/agentic-job-run.repository.js → automations/repositories/automation-run.repository.js} +23 -11
- package/dist/services/{agentic-jobs/repositories/agentic-job-run.repository.mjs → automations/repositories/automation-run.repository.mjs} +19 -7
- package/dist/services/automations/repositories/automation.repository.d.ts +27 -0
- package/dist/services/{agentic-jobs/repositories/agentic-job.repository.js → automations/repositories/automation.repository.js} +17 -17
- package/dist/services/{agentic-jobs/repositories/agentic-job.repository.mjs → automations/repositories/automation.repository.mjs} +13 -13
- package/dist/services/automations/repositories/index.d.ts +2 -0
- package/dist/services/automations/repositories/index.js +24 -0
- package/dist/services/automations/repositories/index.mjs +2 -0
- package/dist/services/automations/runner/automation-runner.d.ts +49 -0
- package/dist/services/{agentic-jobs/runner/agentic-job-runner.js → automations/runner/automation-runner.js} +55 -45
- package/dist/services/{agentic-jobs/runner/agentic-job-runner.mjs → automations/runner/automation-runner.mjs} +50 -40
- package/dist/services/{agentic-jobs/use-cases/attach-agentic-job-run-chat.use-case.d.ts → automations/use-cases/attach-automation-run-chat.use-case.d.ts} +6 -6
- package/dist/services/{agentic-jobs/use-cases/attach-agentic-job-run-chat.use-case.js → automations/use-cases/attach-automation-run-chat.use-case.js} +14 -14
- package/dist/services/automations/use-cases/attach-automation-run-chat.use-case.mjs +29 -0
- package/dist/services/automations/use-cases/claim-due-automations.use-case.d.ts +28 -0
- package/dist/services/{agentic-jobs/use-cases/claim-due-agentic-jobs.use-case.js → automations/use-cases/claim-due-automations.use-case.js} +32 -43
- package/dist/services/automations/use-cases/claim-due-automations.use-case.mjs +70 -0
- package/dist/services/automations/use-cases/claim-queued-automation-runs.use-case.d.ts +27 -0
- package/dist/services/automations/use-cases/claim-queued-automation-runs.use-case.js +106 -0
- package/dist/services/automations/use-cases/claim-queued-automation-runs.use-case.mjs +77 -0
- package/dist/services/automations/use-cases/create-automation.use-case.d.ts +14 -0
- package/dist/services/{agentic-jobs/use-cases/create-agentic-job.use-case.js → automations/use-cases/create-automation.use-case.js} +24 -25
- package/dist/services/automations/use-cases/create-automation.use-case.mjs +43 -0
- package/dist/services/{agentic-jobs/use-cases/delete-agentic-job.use-case.d.ts → automations/use-cases/delete-automation.use-case.d.ts} +6 -6
- package/dist/services/{agentic-jobs/use-cases/delete-agentic-job.use-case.js → automations/use-cases/delete-automation.use-case.js} +17 -17
- package/dist/services/automations/use-cases/delete-automation.use-case.mjs +36 -0
- package/dist/services/{agentic-jobs/use-cases/finish-agentic-job-run.use-case.d.ts → automations/use-cases/finish-automation-run.use-case.d.ts} +8 -8
- package/dist/services/{agentic-jobs/use-cases/finish-agentic-job-run.use-case.js → automations/use-cases/finish-automation-run.use-case.js} +20 -20
- package/dist/services/automations/use-cases/finish-automation-run.use-case.mjs +46 -0
- package/dist/services/{agentic-jobs/use-cases/get-agentic-job-by-id.use-case.d.ts → automations/use-cases/get-automation-by-id.use-case.d.ts} +6 -6
- package/dist/services/{agentic-jobs/use-cases/get-agentic-job-by-id.use-case.js → automations/use-cases/get-automation-by-id.use-case.js} +13 -13
- package/dist/services/automations/use-cases/get-automation-by-id.use-case.mjs +26 -0
- package/dist/services/automations/use-cases/issue-automation-event-token.use-case.d.ts +17 -0
- package/dist/services/automations/use-cases/issue-automation-event-token.use-case.js +59 -0
- package/dist/services/automations/use-cases/issue-automation-event-token.use-case.mjs +30 -0
- package/dist/services/{agentic-jobs/use-cases/list-agentic-job-runs-by-job.use-case.d.ts → automations/use-cases/list-automation-runs-by-automation.use-case.d.ts} +7 -7
- package/dist/services/{agentic-jobs/use-cases/list-agentic-job-runs-by-job.use-case.js → automations/use-cases/list-automation-runs-by-automation.use-case.js} +15 -15
- package/dist/services/automations/use-cases/list-automation-runs-by-automation.use-case.mjs +28 -0
- package/dist/services/{agentic-jobs/use-cases/list-agentic-job-runs-by-user.use-case.d.ts → automations/use-cases/list-automation-runs-by-user.use-case.d.ts} +7 -7
- package/dist/services/{agentic-jobs/use-cases/list-agentic-job-runs-by-user.use-case.js → automations/use-cases/list-automation-runs-by-user.use-case.js} +14 -14
- package/dist/services/{agentic-jobs/use-cases/list-agentic-job-runs-by-user.use-case.mjs → automations/use-cases/list-automation-runs-by-user.use-case.mjs} +11 -11
- package/dist/services/{agentic-jobs/use-cases/list-agentic-jobs-by-user.use-case.d.ts → automations/use-cases/list-automations-by-user.use-case.d.ts} +6 -6
- package/dist/services/{agentic-jobs/use-cases/list-agentic-jobs-by-user.use-case.js → automations/use-cases/list-automations-by-user.use-case.js} +14 -14
- package/dist/services/{agentic-jobs/use-cases/list-agentic-jobs-by-user.use-case.mjs → automations/use-cases/list-automations-by-user.use-case.mjs} +11 -11
- package/dist/services/{agentic-jobs/use-cases/preview-agentic-job-runs.use-case.d.ts → automations/use-cases/preview-automation-runs.use-case.d.ts} +1 -1
- package/dist/services/{agentic-jobs/use-cases/preview-agentic-job-runs.use-case.js → automations/use-cases/preview-automation-runs.use-case.js} +8 -8
- package/dist/services/{agentic-jobs/use-cases/preview-agentic-job-runs.use-case.mjs → automations/use-cases/preview-automation-runs.use-case.mjs} +4 -4
- package/dist/services/automations/use-cases/receive-automation-event.use-case.d.ts +23 -0
- package/dist/services/automations/use-cases/receive-automation-event.use-case.js +97 -0
- package/dist/services/automations/use-cases/receive-automation-event.use-case.mjs +68 -0
- package/dist/services/{agentic-jobs/use-cases/renew-agentic-job-lease.use-case.d.ts → automations/use-cases/renew-automation-lease.use-case.d.ts} +5 -5
- package/dist/services/{agentic-jobs/use-cases/renew-agentic-job-lease.use-case.js → automations/use-cases/renew-automation-lease.use-case.js} +15 -15
- package/dist/services/automations/use-cases/renew-automation-lease.use-case.mjs +29 -0
- package/dist/services/automations/use-cases/revoke-automation-event-token.use-case.d.ts +16 -0
- package/dist/services/automations/use-cases/revoke-automation-event-token.use-case.js +65 -0
- package/dist/services/automations/use-cases/revoke-automation-event-token.use-case.mjs +36 -0
- package/dist/services/automations/use-cases/rotate-automation-event-tokens.use-case.d.ts +14 -0
- package/dist/services/automations/use-cases/rotate-automation-event-tokens.use-case.js +63 -0
- package/dist/services/automations/use-cases/rotate-automation-event-tokens.use-case.mjs +34 -0
- package/dist/services/automations/use-cases/start-automation-run.use-case.d.ts +21 -0
- package/dist/services/{agentic-jobs/use-cases/start-agentic-job-run.use-case.js → automations/use-cases/start-automation-run.use-case.js} +24 -24
- package/dist/services/automations/use-cases/start-automation-run.use-case.mjs +38 -0
- package/dist/services/automations/use-cases/sync-automation-run.use-case.d.ts +20 -0
- package/dist/services/{agentic-jobs/use-cases/sync-agentic-job-run.use-case.js → automations/use-cases/sync-automation-run.use-case.js} +23 -23
- package/dist/services/{agentic-jobs/use-cases/sync-agentic-job-run.use-case.mjs → automations/use-cases/sync-automation-run.use-case.mjs} +21 -21
- package/dist/services/{agentic-jobs/use-cases/sync-agentic-job-runs.use-case.d.ts → automations/use-cases/sync-automation-runs.use-case.d.ts} +5 -5
- package/dist/services/{agentic-jobs/use-cases/sync-agentic-job-runs.use-case.js → automations/use-cases/sync-automation-runs.use-case.js} +16 -16
- package/dist/services/{agentic-jobs/use-cases/sync-agentic-job-runs.use-case.mjs → automations/use-cases/sync-automation-runs.use-case.mjs} +13 -13
- package/dist/services/automations/use-cases/update-automation.use-case.d.ts +15 -0
- package/dist/services/{agentic-jobs/use-cases/update-agentic-job.use-case.js → automations/use-cases/update-automation.use-case.js} +27 -27
- package/dist/services/automations/use-cases/update-automation.use-case.mjs +54 -0
- package/dist/services/automations/utils/automation-event-error.d.ts +6 -0
- package/dist/services/automations/utils/automation-event-error.js +37 -0
- package/dist/services/automations/utils/automation-event-error.mjs +14 -0
- package/dist/services/automations/utils/automation-fields.d.ts +14 -0
- package/dist/services/{agentic-jobs/utils/job-fields.js → automations/utils/automation-fields.js} +8 -10
- package/dist/services/{agentic-jobs/utils/job-fields.mjs → automations/utils/automation-fields.mjs} +4 -6
- package/dist/services/automations/utils/event-message.d.ts +1 -0
- package/dist/services/automations/utils/event-message.js +37 -0
- package/dist/services/automations/utils/event-message.mjs +14 -0
- package/dist/services/automations/utils/event-token.d.ts +18 -0
- package/dist/services/automations/utils/event-token.js +78 -0
- package/dist/services/automations/utils/event-token.mjs +43 -0
- package/dist/services/automations/utils/open-run.d.ts +14 -0
- package/dist/services/{agentic-jobs → automations}/utils/open-run.js +10 -8
- package/dist/services/automations/utils/open-run.mjs +26 -0
- package/dist/services/automations/utils/previous-run.d.ts +4 -0
- package/dist/services/automations/utils/previous-run.js +42 -0
- package/dist/services/automations/utils/previous-run.mjs +19 -0
- package/dist/services/{agentic-jobs → automations}/utils/settings.d.ts +1 -0
- package/dist/services/{agentic-jobs → automations}/utils/settings.js +6 -2
- package/dist/services/automations/utils/settings.mjs +13 -0
- package/dist/services/chats/entities/chat-settings.entity.d.ts +5 -1
- package/dist/services/chats/entities/chat-settings.entity.js +10 -3
- package/dist/services/chats/entities/chat-settings.entity.mjs +10 -3
- package/dist/skills/skill.d.ts +2 -1
- package/dist/skills/skill.js +4 -3
- package/dist/skills/skill.mjs +4 -3
- package/docs/README.md +1 -1
- package/docs/agent.md +3 -2
- package/docs/authentication.md +18 -1
- package/docs/automations.md +341 -0
- package/docs/chats.md +1 -1
- package/docs/configuration.md +8 -7
- package/docs/harness.md +1 -1
- package/docs/integration-guide.md +22 -18
- package/docs/llms.txt +1 -1
- package/docs/mcp-servers.md +1 -1
- package/docs/skills.md +1 -1
- package/examples/{agentic-jobs/create-agentic-job.ts → automations/create-automation.ts} +10 -7
- package/examples/automations/create-event-automation.ts +24 -0
- package/examples/{agentic-jobs/list-agentic-job-runs.ts → automations/list-automation-runs.ts} +8 -8
- package/examples/automations/list-automations.ts +25 -0
- package/examples/{agentic-jobs/preview-agentic-job-runs.ts → automations/preview-automation-runs.ts} +2 -2
- package/examples/automations/receive-automation-event.ts +26 -0
- package/examples/automations/revoke-automation-event-token.ts +25 -0
- package/examples/{agentic-jobs/run-agentic-job-now.ts → automations/run-automation-now.ts} +3 -3
- package/examples/{agentic-jobs/run-agentic-job-worker.ts → automations/run-automation-worker.ts} +6 -6
- package/examples/{agentic-jobs/update-agentic-job.ts → automations/update-automation.ts} +10 -10
- package/package.json +14 -13
- package/dist/db/indexes/agentic-job-runs.d.ts +0 -2
- package/dist/db/indexes/agentic-job-runs.mjs +0 -9
- package/dist/db/indexes/agentic-jobs.d.ts +0 -2
- package/dist/services/agentic-jobs/entities/agentic-job-run.entity.d.ts +0 -42
- package/dist/services/agentic-jobs/entities/agentic-job.entity.d.ts +0 -39
- package/dist/services/agentic-jobs/entities/index.d.ts +0 -3
- package/dist/services/agentic-jobs/entities/index.mjs +0 -3
- package/dist/services/agentic-jobs/index.d.ts +0 -4
- package/dist/services/agentic-jobs/index.mjs +0 -4
- package/dist/services/agentic-jobs/module.d.ts +0 -31
- package/dist/services/agentic-jobs/module.js +0 -132
- package/dist/services/agentic-jobs/module.mjs +0 -95
- package/dist/services/agentic-jobs/repositories/agentic-job-run.repository.d.ts +0 -11
- package/dist/services/agentic-jobs/repositories/agentic-job.repository.d.ts +0 -27
- package/dist/services/agentic-jobs/repositories/index.d.ts +0 -2
- package/dist/services/agentic-jobs/repositories/index.mjs +0 -2
- package/dist/services/agentic-jobs/runner/agentic-job-runner.d.ts +0 -48
- package/dist/services/agentic-jobs/use-cases/attach-agentic-job-run-chat.use-case.mjs +0 -29
- package/dist/services/agentic-jobs/use-cases/claim-due-agentic-jobs.use-case.d.ts +0 -29
- package/dist/services/agentic-jobs/use-cases/claim-due-agentic-jobs.use-case.mjs +0 -81
- package/dist/services/agentic-jobs/use-cases/create-agentic-job.use-case.d.ts +0 -14
- package/dist/services/agentic-jobs/use-cases/create-agentic-job.use-case.mjs +0 -44
- package/dist/services/agentic-jobs/use-cases/delete-agentic-job.use-case.mjs +0 -36
- package/dist/services/agentic-jobs/use-cases/finish-agentic-job-run.use-case.mjs +0 -46
- package/dist/services/agentic-jobs/use-cases/get-agentic-job-by-id.use-case.mjs +0 -26
- package/dist/services/agentic-jobs/use-cases/list-agentic-job-runs-by-job.use-case.mjs +0 -28
- package/dist/services/agentic-jobs/use-cases/renew-agentic-job-lease.use-case.mjs +0 -29
- package/dist/services/agentic-jobs/use-cases/start-agentic-job-run.use-case.d.ts +0 -21
- package/dist/services/agentic-jobs/use-cases/start-agentic-job-run.use-case.mjs +0 -38
- package/dist/services/agentic-jobs/use-cases/sync-agentic-job-run.use-case.d.ts +0 -20
- package/dist/services/agentic-jobs/use-cases/update-agentic-job.use-case.d.ts +0 -15
- package/dist/services/agentic-jobs/use-cases/update-agentic-job.use-case.mjs +0 -54
- package/dist/services/agentic-jobs/utils/job-fields.d.ts +0 -14
- package/dist/services/agentic-jobs/utils/open-run.d.ts +0 -12
- package/dist/services/agentic-jobs/utils/open-run.mjs +0 -24
- package/dist/services/agentic-jobs/utils/settings.mjs +0 -10
- package/docs/agentic-jobs.md +0 -217
- package/examples/agentic-jobs/list-agentic-jobs.ts +0 -25
- /package/dist/services/{agentic-jobs → automations}/entities/recurrence.d.ts +0 -0
- /package/dist/services/{agentic-jobs → automations}/entities/recurrence.js +0 -0
- /package/dist/services/{agentic-jobs → automations}/entities/recurrence.mjs +0 -0
- /package/dist/services/{agentic-jobs → automations}/utils/next-run.d.ts +0 -0
- /package/dist/services/{agentic-jobs → automations}/utils/next-run.js +0 -0
- /package/dist/services/{agentic-jobs → automations}/utils/next-run.mjs +0 -0
package/dist/harness/agent.mjs
CHANGED
|
@@ -30,6 +30,7 @@ import { ToolPipeline } from "./tool-pipeline";
|
|
|
30
30
|
import { NATIVE_TOOLS } from "./native-tools";
|
|
31
31
|
import { buildToolCatalog, isDeclarable, needsSearch } from "./tool-catalog";
|
|
32
32
|
import { LLMError } from "../clients/llm/llm-error.js";
|
|
33
|
+
import { isSelectableThinkingEffort, SELECTABLE_THINKING_EFFORTS } from "../clients/llm/llm-types.js";
|
|
33
34
|
import { resolveModel, toModelRef } from "../clients/llm/model-resolution.js";
|
|
34
35
|
const MCP_CONNECT_RETRY_DELAYS_MS = [1e3, 2e3];
|
|
35
36
|
const MCP_DESCRIPTION_CHARS = 300;
|
|
@@ -52,6 +53,7 @@ class Agent {
|
|
|
52
53
|
strictMode;
|
|
53
54
|
fallbackModel;
|
|
54
55
|
model;
|
|
56
|
+
thinkingEffort;
|
|
55
57
|
_tools;
|
|
56
58
|
_internalMcps = [];
|
|
57
59
|
_mcps = [];
|
|
@@ -158,6 +160,8 @@ class Agent {
|
|
|
158
160
|
this.mcpTokens = mcpTokens ?? {};
|
|
159
161
|
this.serviceToken = serviceToken;
|
|
160
162
|
this.model = void 0;
|
|
163
|
+
this.thinkingEffort = void 0;
|
|
164
|
+
if (options?.thinkingEffort !== void 0 && !isSelectableThinkingEffort(options.thinkingEffort)) throw new Error(`[AGENT] thinkingEffort must be one of ${SELECTABLE_THINKING_EFFORTS.join(", ")}`);
|
|
161
165
|
if (Boolean(options?.modelProvider) !== Boolean(options?.modelName)) throw new Error("[AGENT] Set both modelProvider and modelName, or neither");
|
|
162
166
|
this.answerId = new ObjectId().toString();
|
|
163
167
|
const proceed = await this.preRunner(chatId);
|
|
@@ -245,6 +249,9 @@ class Agent {
|
|
|
245
249
|
});
|
|
246
250
|
this.currentChat.settings?.setModelProvider(this.model.provider);
|
|
247
251
|
this.currentChat.settings?.setModelName(this.model.model);
|
|
252
|
+
if (this.chatOptions?.thinkingEffort) this.currentChat.settings?.setThinkingEffort(this.chatOptions.thinkingEffort);
|
|
253
|
+
const savedEffort = this.currentChat.settings?.thinkingEffort;
|
|
254
|
+
this.thinkingEffort = this.chatOptions?.thinkingEffort ?? (isSelectableThinkingEffort(savedEffort) ? savedEffort : void 0);
|
|
248
255
|
if (this.chatOptions?.loopName) this.currentChat.settings?.setLoopName(this.chatOptions.loopName);
|
|
249
256
|
this.awaitingConfirmation = this.currentChat.state?.status === AgentStatus.AWAITING_USER_CONFIRMATION;
|
|
250
257
|
this.currentChat.state?.setStatus(AgentStatus.PROCESSING);
|
|
@@ -848,6 +855,7 @@ Ref: ${guard.ref}`, { source: "harness", excludeFromContext: true });
|
|
|
848
855
|
task: this.currentChat.activeTask,
|
|
849
856
|
chat: this.currentChat,
|
|
850
857
|
chatOptions: this.chatOptions,
|
|
858
|
+
thinkingEffort: this.thinkingEffort,
|
|
851
859
|
currentUser: this.currentUser,
|
|
852
860
|
currentSession: this.currentSession,
|
|
853
861
|
currentMessage: this.currentMessage,
|
package/dist/loops/agi/loop.js
CHANGED
|
@@ -50,7 +50,7 @@ class AgiLoop extends import_harness.AgentLoop {
|
|
|
50
50
|
return "agi";
|
|
51
51
|
}
|
|
52
52
|
get version() {
|
|
53
|
-
return "1.8.
|
|
53
|
+
return "1.8.7";
|
|
54
54
|
}
|
|
55
55
|
get author() {
|
|
56
56
|
return {
|
|
@@ -106,6 +106,7 @@ class AgiLoop extends import_harness.AgentLoop {
|
|
|
106
106
|
const catalog = await harness.toolCatalog();
|
|
107
107
|
const result = await import_reasoning_engine.reasoningEngine.run({
|
|
108
108
|
...ctx.skillParams,
|
|
109
|
+
thinking: ctx.thinkingEffort,
|
|
109
110
|
history: task.history({
|
|
110
111
|
budget: { turns_left: MAX_TURNS - task.turnCount, tool_calls_left: MAX_TOOL_CALLS - task.toolCallCount },
|
|
111
112
|
...warning ? { warning } : {},
|
package/dist/loops/agi/loop.mjs
CHANGED
|
@@ -28,7 +28,7 @@ class AgiLoop extends AgentLoop {
|
|
|
28
28
|
return "agi";
|
|
29
29
|
}
|
|
30
30
|
get version() {
|
|
31
|
-
return "1.8.
|
|
31
|
+
return "1.8.7";
|
|
32
32
|
}
|
|
33
33
|
get author() {
|
|
34
34
|
return {
|
|
@@ -84,6 +84,7 @@ class AgiLoop extends AgentLoop {
|
|
|
84
84
|
const catalog = await harness.toolCatalog();
|
|
85
85
|
const result = await reasoningEngine.run({
|
|
86
86
|
...ctx.skillParams,
|
|
87
|
+
thinking: ctx.thinkingEffort,
|
|
87
88
|
history: task.history({
|
|
88
89
|
budget: { turns_left: MAX_TURNS - task.turnCount, tool_calls_left: MAX_TOOL_CALLS - task.toolCallCount },
|
|
89
90
|
...warning ? { warning } : {},
|
|
@@ -25,9 +25,10 @@ var import_skill = require("../../../skills/skill.js");
|
|
|
25
25
|
var import_shared_rules = require("../../../skills/shared/shared-rules.js");
|
|
26
26
|
const reasoningEngine = new import_skill.Skill({
|
|
27
27
|
name: "reasoning_engine",
|
|
28
|
-
version: "2.5.
|
|
28
|
+
version: "2.5.4",
|
|
29
29
|
description: "Continuous reasoning cycle of the agent: reads the situation or the results of its last actions, rewrites its working state and decides the next actions, including the final answer.",
|
|
30
30
|
temperature: 0.3,
|
|
31
|
+
thinking: "medium",
|
|
31
32
|
systemRole: true,
|
|
32
33
|
systemInstructions: {
|
|
33
34
|
instruction_set: {
|
|
@@ -39,7 +40,7 @@ const reasoningEngine = new import_skill.Skill({
|
|
|
39
40
|
"STATE: Your state is your working memory and the harness returns it to you in the next cycle. Rewrite it completely in every response, carrying forward what still matters. Use these keys, each a short text: 'objective' (what the user wants, in your own words), 'progress' (what is done and learned so far, citing refs), 'tried' (what you attempted that failed or gave nothing, so you never repeat it), 'expecting' (what you expect these actions to return) and 'next' (what you will do once you have it).",
|
|
40
41
|
`LEARNED: 'learned' is an optional list of {"key": "...", "value": "..."} with the facts you will need in later cycles and must not lose: entities with their exact identifiers (for example the customer or document the user chose, and its id), schemas of tools you will call, and decisions of the user. Add only what is new. The harness keeps it and returns all of it in HARNESS.known in every cycle, so you do not need to copy it into the state. Before an action that targets an entity, use the one in HARNESS.known, and never replace it with a different one unless the user asks. Before calling a tool, take its argument names from HARNESS.schemas when it is listed there.`,
|
|
41
42
|
`ACTIONS: 'actions' is a list of objects like {"tool": "<exact tool name>", "arguments": {...}}. The tool must be one of the names in your tool list. Copy the name character by character, including the server prefix of external tools (like 'server__tool'), which is part of the name. The only thing you may drop is a leading 'functions.'. The arguments must match its schema. You cannot call tools natively: you only ask for them through actions. Independent actions in the same response run in parallel; dependent ones go in later responses. Never invent tool names or arguments.`,
|
|
42
|
-
"ACTIVITY: Always write 'activity'. It is shown to the user while the actions you ask for run and while you think about their results, until your next response. Write one short sentence of at most 60 characters: a verb in the progressive form followed by what is being looked up or done, taken from the user's request. It must be in the language of 'language' and of the message of the user, never in the language of these instructions. Never mention tool names, ids, refs or technical terms, never include
|
|
43
|
+
"ACTIVITY: Always write 'activity'. It is shown to the user while the actions you ask for run and while you think about their results, until your next response. Write one short sentence of at most 60 characters: a verb in the progressive form followed by what is being looked up or done, taken from the user's request. It must be in the language of 'language' and of the message of the user, never in the language of these instructions. Never mention tool names, ids, refs or technical terms, never include personal data, and do not promise a result. The only exception is when your actions just deliver the final answer: then leave it out.",
|
|
43
44
|
"NEVER_EMPTY: 'actions' always has at least one action. 'reasoning' and 'state' are never shown to the user, so writing there that you will answer or summarize delivers nothing. As soon as you have what you need, your action is 'respond' with the complete final answer, written in that same response.",
|
|
44
45
|
`LOOP: After your actions run, the next message you receive is {"OBSERVATIONS": [...]} with one entry per action (ref, tool, status, output or error). Continue from there. You finish the task only with a 'respond' action, which delivers your final answer; use it alone or with actions whose results you no longer need.`,
|
|
45
46
|
"HARNESS_NOTICES: A message may contain a 'HARNESS' key with notices from your body, such as the remaining budget, a warning, a stop reason, 'known' (the facts kept for you, including the answers of the user) or 'schemas' (the arguments of the tools you have already seen). Obey them.",
|
|
@@ -3,9 +3,10 @@ import { Skill } from "../../../skills/skill.js";
|
|
|
3
3
|
import { FORMATTING, LATEX_FORMATTING, CITATION_FORMATTING } from "../../../skills/shared/shared-rules.js";
|
|
4
4
|
const reasoningEngine = new Skill({
|
|
5
5
|
name: "reasoning_engine",
|
|
6
|
-
version: "2.5.
|
|
6
|
+
version: "2.5.4",
|
|
7
7
|
description: "Continuous reasoning cycle of the agent: reads the situation or the results of its last actions, rewrites its working state and decides the next actions, including the final answer.",
|
|
8
8
|
temperature: 0.3,
|
|
9
|
+
thinking: "medium",
|
|
9
10
|
systemRole: true,
|
|
10
11
|
systemInstructions: {
|
|
11
12
|
instruction_set: {
|
|
@@ -17,7 +18,7 @@ const reasoningEngine = new Skill({
|
|
|
17
18
|
"STATE: Your state is your working memory and the harness returns it to you in the next cycle. Rewrite it completely in every response, carrying forward what still matters. Use these keys, each a short text: 'objective' (what the user wants, in your own words), 'progress' (what is done and learned so far, citing refs), 'tried' (what you attempted that failed or gave nothing, so you never repeat it), 'expecting' (what you expect these actions to return) and 'next' (what you will do once you have it).",
|
|
18
19
|
`LEARNED: 'learned' is an optional list of {"key": "...", "value": "..."} with the facts you will need in later cycles and must not lose: entities with their exact identifiers (for example the customer or document the user chose, and its id), schemas of tools you will call, and decisions of the user. Add only what is new. The harness keeps it and returns all of it in HARNESS.known in every cycle, so you do not need to copy it into the state. Before an action that targets an entity, use the one in HARNESS.known, and never replace it with a different one unless the user asks. Before calling a tool, take its argument names from HARNESS.schemas when it is listed there.`,
|
|
19
20
|
`ACTIONS: 'actions' is a list of objects like {"tool": "<exact tool name>", "arguments": {...}}. The tool must be one of the names in your tool list. Copy the name character by character, including the server prefix of external tools (like 'server__tool'), which is part of the name. The only thing you may drop is a leading 'functions.'. The arguments must match its schema. You cannot call tools natively: you only ask for them through actions. Independent actions in the same response run in parallel; dependent ones go in later responses. Never invent tool names or arguments.`,
|
|
20
|
-
"ACTIVITY: Always write 'activity'. It is shown to the user while the actions you ask for run and while you think about their results, until your next response. Write one short sentence of at most 60 characters: a verb in the progressive form followed by what is being looked up or done, taken from the user's request. It must be in the language of 'language' and of the message of the user, never in the language of these instructions. Never mention tool names, ids, refs or technical terms, never include
|
|
21
|
+
"ACTIVITY: Always write 'activity'. It is shown to the user while the actions you ask for run and while you think about their results, until your next response. Write one short sentence of at most 60 characters: a verb in the progressive form followed by what is being looked up or done, taken from the user's request. It must be in the language of 'language' and of the message of the user, never in the language of these instructions. Never mention tool names, ids, refs or technical terms, never include personal data, and do not promise a result. The only exception is when your actions just deliver the final answer: then leave it out.",
|
|
21
22
|
"NEVER_EMPTY: 'actions' always has at least one action. 'reasoning' and 'state' are never shown to the user, so writing there that you will answer or summarize delivers nothing. As soon as you have what you need, your action is 'respond' with the complete final answer, written in that same response.",
|
|
22
23
|
`LOOP: After your actions run, the next message you receive is {"OBSERVATIONS": [...]} with one entry per action (ref, tool, status, output or error). Continue from there. You finish the task only with a 'respond' action, which delivers your final answer; use it alone or with actions whose results you no longer need.`,
|
|
23
24
|
"HARNESS_NOTICES: A message may contain a 'HARNESS' key with notices from your body, such as the remaining budget, a warning, a stop reason, 'known' (the facts kept for you, including the answers of the user) or 'schemas' (the arguments of the tools you have already seen). Obey them.",
|
|
@@ -25,7 +25,7 @@ var import_skill = require("../../../skills/skill.js");
|
|
|
25
25
|
var import_shared_rules = require("../../../skills/shared/shared-rules.js");
|
|
26
26
|
const fastResponder = new import_skill.Skill({
|
|
27
27
|
name: "fast_responder",
|
|
28
|
-
version: "2.4.
|
|
28
|
+
version: "2.4.3",
|
|
29
29
|
description: "Handles general conversations and multipurpose user assistance.",
|
|
30
30
|
temperature: 0.7,
|
|
31
31
|
thinking: "low",
|
|
@@ -42,7 +42,7 @@ const fastResponder = new import_skill.Skill({
|
|
|
42
42
|
"LANGUAGE_DETECTION: Identify the language of the CURRENT user message in INPUT.user_message, or follow any explicit request to answer in a specific language (e.g., 'responde en espa\xF1ol', 'reply in English'). Base this decision ONLY on the actual text the user just typed. CONTEXT.user_details.preferred_language reflects the app's configured display language, NOT what the user is typing right now \u2014 it MUST NEVER influence this detection, even when it disagrees with the message's actual language. Always generate the 'answer' field in that detected or requested language, and set 'detected_language' in the output to its 2-letter ISO 639-1 code (e.g., 'es', 'en', 'fr').",
|
|
43
43
|
"MEMORY_AND_PERSONAL_DATA_CHECK: Do NOT assume, pretend, or hallucinate remembering past events, meetings, notes, or specific user context. If the user asks about something mentioned in the past (e.g., 'recuerdas la reuni\xF3n...?', 'qu\xE9 te dije de...?'), set 'can_answer' to false UNLESS the exact details are explicitly provided inside 'context_injection'. Never fake memory.",
|
|
44
44
|
"CAPABILITY_CHECK: Set 'can_answer' to false if: 1) The query involves creating, registering, updating, or deleting data or non-text resources (e.g., expenses, records, reminders, calendar entries), 2) The query refers to personal memory, past events, meetings, or stored notes not present in 'context_injection', 3) The query requires specialized skills or tools (e.g., searching databases, calendar lookup, external integrations), 4) The query requires live internet access (news, weather, live data), 5) The query is a correction, rejection, or negative feedback regarding a previously executed task or tool response (e.g., 'no era esa fecha', 'te equivocaste', 'busca otra opci\xF3n', 'eso no sirvi\xF3'). When 'can_answer' is false, leave 'answer' minimal or empty for the fallback engine.",
|
|
45
|
-
"ACTIVITY: When 'can_answer' is false, always write in 'activity' one short sentence of at most 60 characters: a verb in the present or progressive form followed by what you will look up or do, taken from the user's request. It must be in 'detected_language' and match the language of the message of the user, never the language of these instructions. Never mention tool names or technical terms, never include
|
|
45
|
+
"ACTIVITY: When 'can_answer' is false, always write in 'activity' one short sentence of at most 60 characters: a verb in the present or progressive form followed by what you will look up or do, taken from the user's request. It must be in 'detected_language' and match the language of the message of the user, never the language of these instructions. Never mention tool names or technical terms, never include personal data, and do not promise a result. Leave it empty when 'can_answer' is true.",
|
|
46
46
|
"REASONING: Always generate the 'reasoning' field with a short explanation in English of the decision-making process, regardless of whether 'can_answer' is true or false.",
|
|
47
47
|
import_shared_rules.FORMATTING,
|
|
48
48
|
import_shared_rules.LATEX_FORMATTING,
|
|
@@ -3,7 +3,7 @@ import { Skill } from "../../../skills/skill.js";
|
|
|
3
3
|
import { FORMATTING, LATEX_FORMATTING, CITATION_FORMATTING, POLICY_RESTRICTIONS } from "../../../skills/shared/shared-rules.js";
|
|
4
4
|
const fastResponder = new Skill({
|
|
5
5
|
name: "fast_responder",
|
|
6
|
-
version: "2.4.
|
|
6
|
+
version: "2.4.3",
|
|
7
7
|
description: "Handles general conversations and multipurpose user assistance.",
|
|
8
8
|
temperature: 0.7,
|
|
9
9
|
thinking: "low",
|
|
@@ -20,7 +20,7 @@ const fastResponder = new Skill({
|
|
|
20
20
|
"LANGUAGE_DETECTION: Identify the language of the CURRENT user message in INPUT.user_message, or follow any explicit request to answer in a specific language (e.g., 'responde en espa\xF1ol', 'reply in English'). Base this decision ONLY on the actual text the user just typed. CONTEXT.user_details.preferred_language reflects the app's configured display language, NOT what the user is typing right now \u2014 it MUST NEVER influence this detection, even when it disagrees with the message's actual language. Always generate the 'answer' field in that detected or requested language, and set 'detected_language' in the output to its 2-letter ISO 639-1 code (e.g., 'es', 'en', 'fr').",
|
|
21
21
|
"MEMORY_AND_PERSONAL_DATA_CHECK: Do NOT assume, pretend, or hallucinate remembering past events, meetings, notes, or specific user context. If the user asks about something mentioned in the past (e.g., 'recuerdas la reuni\xF3n...?', 'qu\xE9 te dije de...?'), set 'can_answer' to false UNLESS the exact details are explicitly provided inside 'context_injection'. Never fake memory.",
|
|
22
22
|
"CAPABILITY_CHECK: Set 'can_answer' to false if: 1) The query involves creating, registering, updating, or deleting data or non-text resources (e.g., expenses, records, reminders, calendar entries), 2) The query refers to personal memory, past events, meetings, or stored notes not present in 'context_injection', 3) The query requires specialized skills or tools (e.g., searching databases, calendar lookup, external integrations), 4) The query requires live internet access (news, weather, live data), 5) The query is a correction, rejection, or negative feedback regarding a previously executed task or tool response (e.g., 'no era esa fecha', 'te equivocaste', 'busca otra opci\xF3n', 'eso no sirvi\xF3'). When 'can_answer' is false, leave 'answer' minimal or empty for the fallback engine.",
|
|
23
|
-
"ACTIVITY: When 'can_answer' is false, always write in 'activity' one short sentence of at most 60 characters: a verb in the present or progressive form followed by what you will look up or do, taken from the user's request. It must be in 'detected_language' and match the language of the message of the user, never the language of these instructions. Never mention tool names or technical terms, never include
|
|
23
|
+
"ACTIVITY: When 'can_answer' is false, always write in 'activity' one short sentence of at most 60 characters: a verb in the present or progressive form followed by what you will look up or do, taken from the user's request. It must be in 'detected_language' and match the language of the message of the user, never the language of these instructions. Never mention tool names or technical terms, never include personal data, and do not promise a result. Leave it empty when 'can_answer' is true.",
|
|
24
24
|
"REASONING: Always generate the 'reasoning' field with a short explanation in English of the decision-making process, regardless of whether 'can_answer' is true or false.",
|
|
25
25
|
FORMATTING,
|
|
26
26
|
LATEX_FORMATTING,
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export * from './revoked-token.entity';
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __defProp = Object.defineProperty;
|
|
3
|
+
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
4
|
+
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
5
|
+
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
6
|
+
var __copyProps = (to, from, except, desc) => {
|
|
7
|
+
if (from && typeof from === "object" || typeof from === "function") {
|
|
8
|
+
for (let key of __getOwnPropNames(from))
|
|
9
|
+
if (!__hasOwnProp.call(to, key) && key !== except)
|
|
10
|
+
__defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
|
|
11
|
+
}
|
|
12
|
+
return to;
|
|
13
|
+
};
|
|
14
|
+
var __reExport = (target, mod, secondTarget) => (__copyProps(target, mod, "default"), secondTarget && __copyProps(secondTarget, mod, "default"));
|
|
15
|
+
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
|
16
|
+
var entities_exports = {};
|
|
17
|
+
module.exports = __toCommonJS(entities_exports);
|
|
18
|
+
__reExport(entities_exports, require("./revoked-token.entity"), module.exports);
|
|
19
|
+
// Annotate the CommonJS export names for ESM import in node:
|
|
20
|
+
0 && (module.exports = {
|
|
21
|
+
...require("./revoked-token.entity")
|
|
22
|
+
});
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export * from "./revoked-token.entity";
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
import { BaseEntity, BaseEntityProps } from '../../../common/base/base.entity.js';
|
|
2
|
+
export interface RevokedTokenProps extends BaseEntityProps {
|
|
3
|
+
jti?: string;
|
|
4
|
+
audience?: string;
|
|
5
|
+
subject?: string;
|
|
6
|
+
expiresAt?: string | Date;
|
|
7
|
+
}
|
|
8
|
+
export declare class RevokedToken extends BaseEntity {
|
|
9
|
+
private readonly props;
|
|
10
|
+
jti?: string | undefined;
|
|
11
|
+
audience?: string | undefined;
|
|
12
|
+
subject?: string | undefined;
|
|
13
|
+
expiresAt?: Date | undefined;
|
|
14
|
+
static fromJSON(props: RevokedTokenProps): RevokedToken;
|
|
15
|
+
constructor(props: RevokedTokenProps, jti?: string | undefined, audience?: string | undefined, subject?: string | undefined, expiresAt?: Date | undefined);
|
|
16
|
+
toJSON(): RevokedTokenProps;
|
|
17
|
+
}
|
|
@@ -0,0 +1,67 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __defProp = Object.defineProperty;
|
|
3
|
+
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
4
|
+
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
5
|
+
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
6
|
+
var __export = (target, all) => {
|
|
7
|
+
for (var name in all)
|
|
8
|
+
__defProp(target, name, { get: all[name], enumerable: true });
|
|
9
|
+
};
|
|
10
|
+
var __copyProps = (to, from, except, desc) => {
|
|
11
|
+
if (from && typeof from === "object" || typeof from === "function") {
|
|
12
|
+
for (let key of __getOwnPropNames(from))
|
|
13
|
+
if (!__hasOwnProp.call(to, key) && key !== except)
|
|
14
|
+
__defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
|
|
15
|
+
}
|
|
16
|
+
return to;
|
|
17
|
+
};
|
|
18
|
+
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
|
19
|
+
var revoked_token_entity_exports = {};
|
|
20
|
+
__export(revoked_token_entity_exports, {
|
|
21
|
+
RevokedToken: () => RevokedToken
|
|
22
|
+
});
|
|
23
|
+
module.exports = __toCommonJS(revoked_token_entity_exports);
|
|
24
|
+
var import_base = require("../../../common/base/base.entity.js");
|
|
25
|
+
const toDate = (value) => {
|
|
26
|
+
if (!value) return void 0;
|
|
27
|
+
const date = new Date(value);
|
|
28
|
+
if (Number.isNaN(date.getTime())) throw new Error("{{value_must_be_a_date}}");
|
|
29
|
+
return date;
|
|
30
|
+
};
|
|
31
|
+
class RevokedToken extends import_base.BaseEntity {
|
|
32
|
+
constructor(props, jti, audience, subject, expiresAt) {
|
|
33
|
+
super(props);
|
|
34
|
+
this.props = props;
|
|
35
|
+
this.jti = jti;
|
|
36
|
+
this.audience = audience;
|
|
37
|
+
this.subject = subject;
|
|
38
|
+
this.expiresAt = expiresAt;
|
|
39
|
+
}
|
|
40
|
+
props;
|
|
41
|
+
jti;
|
|
42
|
+
audience;
|
|
43
|
+
subject;
|
|
44
|
+
expiresAt;
|
|
45
|
+
static fromJSON(props) {
|
|
46
|
+
return new RevokedToken(
|
|
47
|
+
props,
|
|
48
|
+
props.jti || void 0,
|
|
49
|
+
props.audience || void 0,
|
|
50
|
+
props.subject || void 0,
|
|
51
|
+
toDate(props.expiresAt)
|
|
52
|
+
);
|
|
53
|
+
}
|
|
54
|
+
toJSON() {
|
|
55
|
+
return {
|
|
56
|
+
...super.toJSON(),
|
|
57
|
+
jti: this.jti,
|
|
58
|
+
audience: this.audience,
|
|
59
|
+
subject: this.subject,
|
|
60
|
+
expiresAt: this.expiresAt
|
|
61
|
+
};
|
|
62
|
+
}
|
|
63
|
+
}
|
|
64
|
+
// Annotate the CommonJS export names for ESM import in node:
|
|
65
|
+
0 && (module.exports = {
|
|
66
|
+
RevokedToken
|
|
67
|
+
});
|
|
@@ -0,0 +1,44 @@
|
|
|
1
|
+
import "../../../chunk-CF3WOMB3.mjs";
|
|
2
|
+
import { BaseEntity } from "../../../common/base/base.entity.js";
|
|
3
|
+
const toDate = (value) => {
|
|
4
|
+
if (!value) return void 0;
|
|
5
|
+
const date = new Date(value);
|
|
6
|
+
if (Number.isNaN(date.getTime())) throw new Error("{{value_must_be_a_date}}");
|
|
7
|
+
return date;
|
|
8
|
+
};
|
|
9
|
+
class RevokedToken extends BaseEntity {
|
|
10
|
+
constructor(props, jti, audience, subject, expiresAt) {
|
|
11
|
+
super(props);
|
|
12
|
+
this.props = props;
|
|
13
|
+
this.jti = jti;
|
|
14
|
+
this.audience = audience;
|
|
15
|
+
this.subject = subject;
|
|
16
|
+
this.expiresAt = expiresAt;
|
|
17
|
+
}
|
|
18
|
+
props;
|
|
19
|
+
jti;
|
|
20
|
+
audience;
|
|
21
|
+
subject;
|
|
22
|
+
expiresAt;
|
|
23
|
+
static fromJSON(props) {
|
|
24
|
+
return new RevokedToken(
|
|
25
|
+
props,
|
|
26
|
+
props.jti || void 0,
|
|
27
|
+
props.audience || void 0,
|
|
28
|
+
props.subject || void 0,
|
|
29
|
+
toDate(props.expiresAt)
|
|
30
|
+
);
|
|
31
|
+
}
|
|
32
|
+
toJSON() {
|
|
33
|
+
return {
|
|
34
|
+
...super.toJSON(),
|
|
35
|
+
jti: this.jti,
|
|
36
|
+
audience: this.audience,
|
|
37
|
+
subject: this.subject,
|
|
38
|
+
expiresAt: this.expiresAt
|
|
39
|
+
};
|
|
40
|
+
}
|
|
41
|
+
}
|
|
42
|
+
export {
|
|
43
|
+
RevokedToken
|
|
44
|
+
};
|
|
@@ -16,7 +16,9 @@ var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: tru
|
|
|
16
16
|
var authentication_exports = {};
|
|
17
17
|
module.exports = __toCommonJS(authentication_exports);
|
|
18
18
|
__reExport(authentication_exports, require("./module"), module.exports);
|
|
19
|
+
__reExport(authentication_exports, require("./entities"), module.exports);
|
|
19
20
|
// Annotate the CommonJS export names for ESM import in node:
|
|
20
21
|
0 && (module.exports = {
|
|
21
|
-
...require("./module")
|
|
22
|
+
...require("./module"),
|
|
23
|
+
...require("./entities")
|
|
22
24
|
});
|
|
@@ -1,3 +1,7 @@
|
|
|
1
1
|
import 'reflect-metadata';
|
|
2
2
|
import { Params as LParams, Output as LOutput } from './use-cases/login.use-case';
|
|
3
|
+
import { Params as RParams, Output as ROutput } from './use-cases/revoke-token.use-case';
|
|
4
|
+
import { Params as IParams, Output as IOutput } from './use-cases/is-token-revoked.use-case';
|
|
3
5
|
export declare function login(props: LParams): Promise<LOutput>;
|
|
6
|
+
export declare function revokeToken(props: RParams): Promise<ROutput>;
|
|
7
|
+
export declare function isTokenRevoked(props: IParams): Promise<IOutput>;
|
|
@@ -18,17 +18,31 @@ var __copyProps = (to, from, except, desc) => {
|
|
|
18
18
|
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
|
19
19
|
var module_exports = {};
|
|
20
20
|
__export(module_exports, {
|
|
21
|
-
|
|
21
|
+
isTokenRevoked: () => isTokenRevoked,
|
|
22
|
+
login: () => login,
|
|
23
|
+
revokeToken: () => revokeToken
|
|
22
24
|
});
|
|
23
25
|
module.exports = __toCommonJS(module_exports);
|
|
24
26
|
var import_reflect_metadata = require("reflect-metadata");
|
|
25
27
|
var import_tsyringe = require("tsyringe");
|
|
26
28
|
var import_login = require("./use-cases/login.use-case");
|
|
29
|
+
var import_revoke_token = require("./use-cases/revoke-token.use-case");
|
|
30
|
+
var import_is_token_revoked = require("./use-cases/is-token-revoked.use-case");
|
|
27
31
|
async function login(props) {
|
|
28
32
|
const loginUseCase = import_tsyringe.container.resolve(import_login.LoginUseCase);
|
|
29
33
|
return loginUseCase.execute(props);
|
|
30
34
|
}
|
|
35
|
+
async function revokeToken(props) {
|
|
36
|
+
const revokeTokenUseCase = import_tsyringe.container.resolve(import_revoke_token.RevokeTokenUseCase);
|
|
37
|
+
return revokeTokenUseCase.execute(props);
|
|
38
|
+
}
|
|
39
|
+
async function isTokenRevoked(props) {
|
|
40
|
+
const isTokenRevokedUseCase = import_tsyringe.container.resolve(import_is_token_revoked.IsTokenRevokedUseCase);
|
|
41
|
+
return isTokenRevokedUseCase.execute(props);
|
|
42
|
+
}
|
|
31
43
|
// Annotate the CommonJS export names for ESM import in node:
|
|
32
44
|
0 && (module.exports = {
|
|
33
|
-
|
|
45
|
+
isTokenRevoked,
|
|
46
|
+
login,
|
|
47
|
+
revokeToken
|
|
34
48
|
});
|
|
@@ -2,10 +2,22 @@ import "../../chunk-CF3WOMB3.mjs";
|
|
|
2
2
|
import "reflect-metadata";
|
|
3
3
|
import { container } from "tsyringe";
|
|
4
4
|
import { LoginUseCase } from "./use-cases/login.use-case";
|
|
5
|
+
import { RevokeTokenUseCase } from "./use-cases/revoke-token.use-case";
|
|
6
|
+
import { IsTokenRevokedUseCase } from "./use-cases/is-token-revoked.use-case";
|
|
5
7
|
async function login(props) {
|
|
6
8
|
const loginUseCase = container.resolve(LoginUseCase);
|
|
7
9
|
return loginUseCase.execute(props);
|
|
8
10
|
}
|
|
11
|
+
async function revokeToken(props) {
|
|
12
|
+
const revokeTokenUseCase = container.resolve(RevokeTokenUseCase);
|
|
13
|
+
return revokeTokenUseCase.execute(props);
|
|
14
|
+
}
|
|
15
|
+
async function isTokenRevoked(props) {
|
|
16
|
+
const isTokenRevokedUseCase = container.resolve(IsTokenRevokedUseCase);
|
|
17
|
+
return isTokenRevokedUseCase.execute(props);
|
|
18
|
+
}
|
|
9
19
|
export {
|
|
10
|
-
|
|
20
|
+
isTokenRevoked,
|
|
21
|
+
login,
|
|
22
|
+
revokeToken
|
|
11
23
|
};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export * from './revoked-token.repository';
|
|
@@ -15,10 +15,8 @@ var __reExport = (target, mod, secondTarget) => (__copyProps(target, mod, "defau
|
|
|
15
15
|
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
|
16
16
|
var repositories_exports = {};
|
|
17
17
|
module.exports = __toCommonJS(repositories_exports);
|
|
18
|
-
__reExport(repositories_exports, require("./
|
|
19
|
-
__reExport(repositories_exports, require("./agentic-job-run.repository"), module.exports);
|
|
18
|
+
__reExport(repositories_exports, require("./revoked-token.repository"), module.exports);
|
|
20
19
|
// Annotate the CommonJS export names for ESM import in node:
|
|
21
20
|
0 && (module.exports = {
|
|
22
|
-
...require("./
|
|
23
|
-
...require("./agentic-job-run.repository")
|
|
21
|
+
...require("./revoked-token.repository")
|
|
24
22
|
});
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export * from "./revoked-token.repository";
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
import { MongoRepository } from '../../../common/repositories/index.js';
|
|
2
|
+
import { RevokedToken, RevokedTokenProps } from '../entities';
|
|
3
|
+
export declare class RevokedTokenRepository {
|
|
4
|
+
readonly _: MongoRepository<RevokedTokenProps>;
|
|
5
|
+
create(token: RevokedToken): Promise<RevokedToken>;
|
|
6
|
+
findByJti(jti: string): Promise<RevokedTokenProps | null>;
|
|
7
|
+
}
|
|
@@ -0,0 +1,55 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __defProp = Object.defineProperty;
|
|
3
|
+
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
4
|
+
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
5
|
+
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
6
|
+
var __export = (target, all) => {
|
|
7
|
+
for (var name in all)
|
|
8
|
+
__defProp(target, name, { get: all[name], enumerable: true });
|
|
9
|
+
};
|
|
10
|
+
var __copyProps = (to, from, except, desc) => {
|
|
11
|
+
if (from && typeof from === "object" || typeof from === "function") {
|
|
12
|
+
for (let key of __getOwnPropNames(from))
|
|
13
|
+
if (!__hasOwnProp.call(to, key) && key !== except)
|
|
14
|
+
__defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
|
|
15
|
+
}
|
|
16
|
+
return to;
|
|
17
|
+
};
|
|
18
|
+
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
|
19
|
+
var __decorateClass = (decorators, target, key, kind) => {
|
|
20
|
+
var result = kind > 1 ? void 0 : kind ? __getOwnPropDesc(target, key) : target;
|
|
21
|
+
for (var i = decorators.length - 1, decorator; i >= 0; i--)
|
|
22
|
+
if (decorator = decorators[i])
|
|
23
|
+
result = (kind ? decorator(target, key, result) : decorator(result)) || result;
|
|
24
|
+
if (kind && result) __defProp(target, key, result);
|
|
25
|
+
return result;
|
|
26
|
+
};
|
|
27
|
+
var revoked_token_repository_exports = {};
|
|
28
|
+
__export(revoked_token_repository_exports, {
|
|
29
|
+
RevokedTokenRepository: () => RevokedTokenRepository
|
|
30
|
+
});
|
|
31
|
+
module.exports = __toCommonJS(revoked_token_repository_exports);
|
|
32
|
+
var import_tsyringe = require("tsyringe");
|
|
33
|
+
var import_repositories = require("../../../common/repositories/index.js");
|
|
34
|
+
var import_database_name = require("../../../common/utils/database-name.js");
|
|
35
|
+
let RevokedTokenRepository = class {
|
|
36
|
+
_ = new import_repositories.MongoRepository({
|
|
37
|
+
database: (0, import_database_name.getDatabaseName)(),
|
|
38
|
+
collection: "revoked_tokens"
|
|
39
|
+
});
|
|
40
|
+
async create(token) {
|
|
41
|
+
const id = await this._.createOne({ payload: token.toDocument() });
|
|
42
|
+
id && token.setId(id);
|
|
43
|
+
return token;
|
|
44
|
+
}
|
|
45
|
+
async findByJti(jti) {
|
|
46
|
+
return await this._.findOne({ where: { jti } });
|
|
47
|
+
}
|
|
48
|
+
};
|
|
49
|
+
RevokedTokenRepository = __decorateClass([
|
|
50
|
+
(0, import_tsyringe.autoInjectable)()
|
|
51
|
+
], RevokedTokenRepository);
|
|
52
|
+
// Annotate the CommonJS export names for ESM import in node:
|
|
53
|
+
0 && (module.exports = {
|
|
54
|
+
RevokedTokenRepository
|
|
55
|
+
});
|
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
import {
|
|
2
|
+
__decorateClass
|
|
3
|
+
} from "../../../chunk-CF3WOMB3.mjs";
|
|
4
|
+
import { autoInjectable } from "tsyringe";
|
|
5
|
+
import { MongoRepository } from "../../../common/repositories/index.js";
|
|
6
|
+
import { getDatabaseName } from "../../../common/utils/database-name.js";
|
|
7
|
+
let RevokedTokenRepository = class {
|
|
8
|
+
_ = new MongoRepository({
|
|
9
|
+
database: getDatabaseName(),
|
|
10
|
+
collection: "revoked_tokens"
|
|
11
|
+
});
|
|
12
|
+
async create(token) {
|
|
13
|
+
const id = await this._.createOne({ payload: token.toDocument() });
|
|
14
|
+
id && token.setId(id);
|
|
15
|
+
return token;
|
|
16
|
+
}
|
|
17
|
+
async findByJti(jti) {
|
|
18
|
+
return await this._.findOne({ where: { jti } });
|
|
19
|
+
}
|
|
20
|
+
};
|
|
21
|
+
RevokedTokenRepository = __decorateClass([
|
|
22
|
+
autoInjectable()
|
|
23
|
+
], RevokedTokenRepository);
|
|
24
|
+
export {
|
|
25
|
+
RevokedTokenRepository
|
|
26
|
+
};
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
import { BaseUseCase, BaseUseCaseParams, BaseUseCaseOutput } from '../../../common/base/base.use-case.js';
|
|
2
|
+
import { RevokedTokenRepository } from '../repositories';
|
|
3
|
+
export interface Params extends BaseUseCaseParams {
|
|
4
|
+
jti: string;
|
|
5
|
+
}
|
|
6
|
+
export interface Output extends BaseUseCaseOutput {
|
|
7
|
+
data: {
|
|
8
|
+
revoked: boolean;
|
|
9
|
+
};
|
|
10
|
+
}
|
|
11
|
+
export declare class IsTokenRevokedUseCase extends BaseUseCase<Params, Output> {
|
|
12
|
+
private readonly revokedTokenRepository?;
|
|
13
|
+
constructor(revokedTokenRepository?: RevokedTokenRepository | undefined);
|
|
14
|
+
execute(params: Params): Promise<Output>;
|
|
15
|
+
}
|
|
@@ -0,0 +1,55 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __defProp = Object.defineProperty;
|
|
3
|
+
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
4
|
+
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
5
|
+
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
6
|
+
var __export = (target, all) => {
|
|
7
|
+
for (var name in all)
|
|
8
|
+
__defProp(target, name, { get: all[name], enumerable: true });
|
|
9
|
+
};
|
|
10
|
+
var __copyProps = (to, from, except, desc) => {
|
|
11
|
+
if (from && typeof from === "object" || typeof from === "function") {
|
|
12
|
+
for (let key of __getOwnPropNames(from))
|
|
13
|
+
if (!__hasOwnProp.call(to, key) && key !== except)
|
|
14
|
+
__defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
|
|
15
|
+
}
|
|
16
|
+
return to;
|
|
17
|
+
};
|
|
18
|
+
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
|
19
|
+
var __decorateClass = (decorators, target, key, kind) => {
|
|
20
|
+
var result = kind > 1 ? void 0 : kind ? __getOwnPropDesc(target, key) : target;
|
|
21
|
+
for (var i = decorators.length - 1, decorator; i >= 0; i--)
|
|
22
|
+
if (decorator = decorators[i])
|
|
23
|
+
result = (kind ? decorator(target, key, result) : decorator(result)) || result;
|
|
24
|
+
if (kind && result) __defProp(target, key, result);
|
|
25
|
+
return result;
|
|
26
|
+
};
|
|
27
|
+
var __decorateParam = (index, decorator) => (target, key) => decorator(target, key, index);
|
|
28
|
+
var is_token_revoked_use_case_exports = {};
|
|
29
|
+
__export(is_token_revoked_use_case_exports, {
|
|
30
|
+
IsTokenRevokedUseCase: () => IsTokenRevokedUseCase
|
|
31
|
+
});
|
|
32
|
+
module.exports = __toCommonJS(is_token_revoked_use_case_exports);
|
|
33
|
+
var import_tsyringe = require("tsyringe");
|
|
34
|
+
var import_base = require("../../../common/base/base.use-case.js");
|
|
35
|
+
var import_repositories = require("../repositories");
|
|
36
|
+
let IsTokenRevokedUseCase = class extends import_base.BaseUseCase {
|
|
37
|
+
constructor(revokedTokenRepository) {
|
|
38
|
+
super();
|
|
39
|
+
this.revokedTokenRepository = revokedTokenRepository;
|
|
40
|
+
}
|
|
41
|
+
revokedTokenRepository;
|
|
42
|
+
async execute(params) {
|
|
43
|
+
if (!params.jti) throw new Error("The jti is required");
|
|
44
|
+
const found = await this.revokedTokenRepository.findByJti(params.jti);
|
|
45
|
+
return { data: { revoked: Boolean(found) } };
|
|
46
|
+
}
|
|
47
|
+
};
|
|
48
|
+
IsTokenRevokedUseCase = __decorateClass([
|
|
49
|
+
(0, import_tsyringe.autoInjectable)(),
|
|
50
|
+
__decorateParam(0, (0, import_tsyringe.inject)(import_repositories.RevokedTokenRepository))
|
|
51
|
+
], IsTokenRevokedUseCase);
|
|
52
|
+
// Annotate the CommonJS export names for ESM import in node:
|
|
53
|
+
0 && (module.exports = {
|
|
54
|
+
IsTokenRevokedUseCase
|
|
55
|
+
});
|
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
import {
|
|
2
|
+
__decorateClass,
|
|
3
|
+
__decorateParam
|
|
4
|
+
} from "../../../chunk-CF3WOMB3.mjs";
|
|
5
|
+
import { autoInjectable, inject } from "tsyringe";
|
|
6
|
+
import { BaseUseCase } from "../../../common/base/base.use-case.js";
|
|
7
|
+
import { RevokedTokenRepository } from "../repositories";
|
|
8
|
+
let IsTokenRevokedUseCase = class extends BaseUseCase {
|
|
9
|
+
constructor(revokedTokenRepository) {
|
|
10
|
+
super();
|
|
11
|
+
this.revokedTokenRepository = revokedTokenRepository;
|
|
12
|
+
}
|
|
13
|
+
revokedTokenRepository;
|
|
14
|
+
async execute(params) {
|
|
15
|
+
if (!params.jti) throw new Error("The jti is required");
|
|
16
|
+
const found = await this.revokedTokenRepository.findByJti(params.jti);
|
|
17
|
+
return { data: { revoked: Boolean(found) } };
|
|
18
|
+
}
|
|
19
|
+
};
|
|
20
|
+
IsTokenRevokedUseCase = __decorateClass([
|
|
21
|
+
autoInjectable(),
|
|
22
|
+
__decorateParam(0, inject(RevokedTokenRepository))
|
|
23
|
+
], IsTokenRevokedUseCase);
|
|
24
|
+
export {
|
|
25
|
+
IsTokenRevokedUseCase
|
|
26
|
+
};
|