aimeat 1.16.2 → 1.18.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/dist/.env.example +6 -1
- package/dist/locales/en.json +166 -4
- package/dist/locales/fi.json +166 -4
- package/dist/public/components/Card.js +17 -3
- package/dist/public/components/Collapsible.js +39 -0
- package/dist/public/components/CopyButton.js +55 -24
- package/dist/public/components/DataTable.js +57 -0
- package/dist/public/components/EmptyState.js +28 -0
- package/dist/public/components/KeyValueRow.js +37 -0
- package/dist/public/components/Modal.js +22 -5
- package/dist/public/components/Pagination.js +70 -0
- package/dist/public/components/SearchBar.js +44 -0
- package/dist/public/components/StatusDot.js +29 -0
- package/dist/public/components/TagList.js +53 -0
- package/dist/public/components/ToggleSwitch.js +28 -0
- package/dist/public/components/index.js +41 -1
- package/dist/public/css/components/tags.css +24 -0
- package/dist/public/css/style-testbed.css +135 -0
- package/dist/public/css/theme.css +556 -34
- package/dist/public/css/views/admin-agent-integration.css +2 -33
- package/dist/public/css/views/admin.css +730 -686
- package/dist/public/css/views/agents-detail.css +402 -14
- package/dist/public/css/views/help.css +2 -1
- package/dist/public/css/views/hobbies.css +53 -33
- package/dist/public/css/views/marketplace.css +73 -60
- package/dist/public/css/views/openclaw.css +12 -6
- package/dist/public/css/views/portal-classic.css +34 -26
- package/dist/public/css/views/portal-dev.css +41 -32
- package/dist/public/css/views/portal.css +14 -18
- package/dist/public/css/views/profile.css +252 -164
- package/dist/public/css/views/public-knowledge-viewer.css +18 -6
- package/dist/public/css/views/scheduler.css +100 -0
- package/dist/public/js/format.js +41 -0
- package/dist/public/js/services/agent-tasks.js +14 -1
- package/dist/public/js/services/generator-spec-validate.js +5 -1
- package/dist/public/js/services/schedules.js +53 -0
- package/dist/public/js/style-testbed.js +170 -0
- package/dist/public/js/theme.js +114 -0
- package/dist/public/spa.html +74 -16
- package/dist/public/style-testbed.html +420 -0
- package/dist/public/views/admin/agent-integration-tab.js +23 -38
- package/dist/public/views/admin/agent-tasks-tab.js +14 -21
- package/dist/public/views/admin/chat-instances-tab.js +1 -1
- package/dist/public/views/admin/config-tab.js +7 -2
- package/dist/public/views/admin/cortex-tab.js +20 -14
- package/dist/public/views/admin/csm-tab.js +22 -18
- package/dist/public/views/admin/directory-tab.js +3 -3
- package/dist/public/views/admin/email-tab.js +23 -28
- package/dist/public/views/admin/federation-tab.js +15 -5
- package/dist/public/views/admin/generator-debug-tab.js +10 -8
- package/dist/public/views/admin/genesis-tab.js +4 -4
- package/dist/public/views/admin/ghii-tab.js +3 -3
- package/dist/public/views/admin/knowledge-tab.js +15 -5
- package/dist/public/views/admin/matching-tab.js +3 -3
- package/dist/public/views/admin/memory-tab.js +16 -20
- package/dist/public/views/admin/msm-tab.js +30 -17
- package/dist/public/views/admin/overview-tab.js +7 -7
- package/dist/public/views/admin/packages-tab.js +10 -9
- package/dist/public/views/admin/portal-tab.js +14 -4
- package/dist/public/views/admin/prompts-tab.js +5 -5
- package/dist/public/views/admin/push-tab.js +15 -4
- package/dist/public/views/admin/realtime-tab.js +3 -3
- package/dist/public/views/admin/services-tab.js +18 -27
- package/dist/public/views/admin/shared.js +48 -58
- package/dist/public/views/admin/sharing-groups-tab.js +5 -10
- package/dist/public/views/admin/stats-tab.js +3 -3
- package/dist/public/views/guides.js +9 -13
- package/dist/public/views/help.js +3 -24
- package/dist/public/views/hobbies.js +47 -41
- package/dist/public/views/marketplace.js +42 -34
- package/dist/public/views/openclaw.js +0 -1
- package/dist/public/views/portal-classic.js +4 -15
- package/dist/public/views/portal-dev.js +28 -30
- package/dist/public/views/portal.js +16 -21
- package/dist/public/views/portfolio.js +11 -12
- package/dist/public/views/profile/access-tab.js +250 -1
- package/dist/public/views/profile/agents/agent-card.js +75 -4
- package/dist/public/views/profile/agents/tab-activity.js +15 -13
- package/dist/public/views/profile/agents/tab-agent-config.js +60 -6
- package/dist/public/views/profile/agents/tab-integration.js +37 -60
- package/dist/public/views/profile/agents/tab-messages.js +10 -1
- package/dist/public/views/profile/agents/tab-quality.js +25 -19
- package/dist/public/views/profile/agents/tab-schedules.js +110 -0
- package/dist/public/views/profile/agents-activity-subtab.js +4 -4
- package/dist/public/views/profile/agents-services-subtab.js +5 -4
- package/dist/public/views/profile/agents-tab.js +141 -37
- package/dist/public/views/profile/agents-tasks-subtab.js +221 -26
- package/dist/public/views/profile/calibrator-batch.js +5 -11
- package/dist/public/views/profile/calibrator-tab.js +4 -9
- package/dist/public/views/profile/chat-sessions-tab.js +9 -5
- package/dist/public/views/profile/email-tab.js +2 -2
- package/dist/public/views/profile/extensions-tab.js +27 -22
- package/dist/public/views/profile/federation-tab.js +4 -1
- package/dist/public/views/profile/foundry-detail.js +22 -23
- package/dist/public/views/profile/foundry-tab.js +12 -13
- package/dist/public/views/profile/generator-dashboard/DebugPanel.js +4 -7
- package/dist/public/views/profile/generator-dashboard/use-dashboard-core.js +4 -1
- package/dist/public/views/profile/generator-dashboard/use-edit-mode.js +3 -2
- package/dist/public/views/profile/generator-detail.js +26 -30
- package/dist/public/views/profile/generator-tab.js +5 -5
- package/dist/public/views/profile/knowledge-tab.js +12 -12
- package/dist/public/views/profile/landing-page.js +100 -149
- package/dist/public/views/profile/memory-tab.js +15 -11
- package/dist/public/views/profile/node-stats-tab.js +3 -3
- package/dist/public/views/profile/nodes-tab.js +10 -3
- package/dist/public/views/profile/notifications-tab.js +3 -3
- package/dist/public/views/profile/packages-tab.js +14 -14
- package/dist/public/views/profile/scheduler-tab.js +340 -0
- package/dist/public/views/profile/services-tab.js +1 -1
- package/dist/public/views/profile/shared.js +16 -12
- package/dist/public/views/profile/wallet-tab.js +27 -50
- package/dist/public/views/profile/work-tab.js +29 -31
- package/dist/public/views/profile.js +24 -0
- package/dist/public/views/public-knowledge-viewer.js +9 -18
- package/dist/src/auth/middleware.d.ts +3 -2
- package/dist/src/auth/middleware.d.ts.map +1 -1
- package/dist/src/auth/middleware.js +78 -3
- package/dist/src/auth/middleware.js.map +1 -1
- package/dist/src/cli/init-wizard.d.ts.map +1 -1
- package/dist/src/cli/init-wizard.js +13 -1
- package/dist/src/cli/init-wizard.js.map +1 -1
- package/dist/src/config.d.ts +6 -0
- package/dist/src/config.d.ts.map +1 -1
- package/dist/src/config.js +12 -1
- package/dist/src/config.js.map +1 -1
- package/dist/src/generated/api-types.d.ts +708 -8
- package/dist/src/generated/api-types.d.ts.map +1 -1
- package/dist/src/mcp/agent-schedules.d.ts +23 -0
- package/dist/src/mcp/agent-schedules.d.ts.map +1 -0
- package/dist/src/mcp/agent-schedules.js +175 -0
- package/dist/src/mcp/agent-schedules.js.map +1 -0
- package/dist/src/mcp/annotations.d.ts.map +1 -1
- package/dist/src/mcp/annotations.js +6 -0
- package/dist/src/mcp/annotations.js.map +1 -1
- package/dist/src/mcp/catalog/definitions.d.ts.map +1 -1
- package/dist/src/mcp/catalog/definitions.js +55 -0
- package/dist/src/mcp/catalog/definitions.js.map +1 -1
- package/dist/src/mcp/catalog/scopes.d.ts.map +1 -1
- package/dist/src/mcp/catalog/scopes.js +12 -0
- package/dist/src/mcp/catalog/scopes.js.map +1 -1
- package/dist/src/mcp/catalog/surfaces.d.ts.map +1 -1
- package/dist/src/mcp/catalog/surfaces.js +2 -0
- package/dist/src/mcp/catalog/surfaces.js.map +1 -1
- package/dist/src/mcp/index.d.ts.map +1 -1
- package/dist/src/mcp/index.js +2 -0
- package/dist/src/mcp/index.js.map +1 -1
- package/dist/src/models/agent-task-schemas.d.ts +6 -0
- package/dist/src/models/agent-task-schemas.d.ts.map +1 -1
- package/dist/src/models/agent-task-schemas.js +6 -0
- package/dist/src/models/agent-task-schemas.js.map +1 -1
- package/dist/src/models/schemas.d.ts +1 -0
- package/dist/src/models/schemas.d.ts.map +1 -1
- package/dist/src/models/schemas.js +4 -0
- package/dist/src/models/schemas.js.map +1 -1
- package/dist/src/routes/access-tokens.d.ts +17 -0
- package/dist/src/routes/access-tokens.d.ts.map +1 -0
- package/dist/src/routes/access-tokens.js +164 -0
- package/dist/src/routes/access-tokens.js.map +1 -0
- package/dist/src/routes/agent-tasks.d.ts +2 -0
- package/dist/src/routes/agent-tasks.d.ts.map +1 -1
- package/dist/src/routes/agent-tasks.js +118 -23
- package/dist/src/routes/agent-tasks.js.map +1 -1
- package/dist/src/routes/agents.d.ts.map +1 -1
- package/dist/src/routes/agents.js +46 -0
- package/dist/src/routes/agents.js.map +1 -1
- package/dist/src/routes/ai.d.ts +6 -9
- package/dist/src/routes/ai.d.ts.map +1 -1
- package/dist/src/routes/ai.js +26 -175
- package/dist/src/routes/ai.js.map +1 -1
- package/dist/src/routes/apps.d.ts.map +1 -1
- package/dist/src/routes/apps.js +104 -34
- package/dist/src/routes/apps.js.map +1 -1
- package/dist/src/routes/auth.d.ts.map +1 -1
- package/dist/src/routes/auth.js +77 -4
- package/dist/src/routes/auth.js.map +1 -1
- package/dist/src/routes/cortex.d.ts +2 -1
- package/dist/src/routes/cortex.d.ts.map +1 -1
- package/dist/src/routes/cortex.js +13 -8
- package/dist/src/routes/cortex.js.map +1 -1
- package/dist/src/routes/extensions.d.ts.map +1 -1
- package/dist/src/routes/extensions.js +85 -51
- package/dist/src/routes/extensions.js.map +1 -1
- package/dist/src/routes/generator.d.ts.map +1 -1
- package/dist/src/routes/generator.js +109 -43
- package/dist/src/routes/generator.js.map +1 -1
- package/dist/src/routes/ghii.d.ts.map +1 -1
- package/dist/src/routes/ghii.js +34 -13
- package/dist/src/routes/ghii.js.map +1 -1
- package/dist/src/routes/libs.d.ts +15 -0
- package/dist/src/routes/libs.d.ts.map +1 -1
- package/dist/src/routes/libs.js +178 -55
- package/dist/src/routes/libs.js.map +1 -1
- package/dist/src/routes/portal.d.ts.map +1 -1
- package/dist/src/routes/portal.js +1 -0
- package/dist/src/routes/portal.js.map +1 -1
- package/dist/src/routes/schedules.d.ts +33 -0
- package/dist/src/routes/schedules.d.ts.map +1 -0
- package/dist/src/routes/schedules.js +380 -0
- package/dist/src/routes/schedules.js.map +1 -0
- package/dist/src/server-bootstrap/config-init.js +2 -2
- package/dist/src/server-bootstrap/config-init.js.map +1 -1
- package/dist/src/server-bootstrap/routes-loader.d.ts.map +1 -1
- package/dist/src/server-bootstrap/routes-loader.js +7 -0
- package/dist/src/server-bootstrap/routes-loader.js.map +1 -1
- package/dist/src/server-bootstrap/service-init.d.ts.map +1 -1
- package/dist/src/server-bootstrap/service-init.js +2 -1
- package/dist/src/server-bootstrap/service-init.js.map +1 -1
- package/dist/src/services/access-token.d.ts +28 -0
- package/dist/src/services/access-token.d.ts.map +1 -0
- package/dist/src/services/access-token.js +37 -0
- package/dist/src/services/access-token.js.map +1 -0
- package/dist/src/services/ai-completion.d.ts +83 -0
- package/dist/src/services/ai-completion.d.ts.map +1 -0
- package/dist/src/services/ai-completion.js +187 -0
- package/dist/src/services/ai-completion.js.map +1 -0
- package/dist/src/services/config-schema.d.ts.map +1 -1
- package/dist/src/services/config-schema.js +3 -0
- package/dist/src/services/config-schema.js.map +1 -1
- package/dist/src/services/generator-prompt-seeds.d.ts.map +1 -1
- package/dist/src/services/generator-prompt-seeds.js +6 -3
- package/dist/src/services/generator-prompt-seeds.js.map +1 -1
- package/dist/src/services/generator-prompts/spec-validate.d.ts.map +1 -1
- package/dist/src/services/generator-prompts/spec-validate.js +6 -2
- package/dist/src/services/generator-prompts/spec-validate.js.map +1 -1
- package/dist/src/services/generator-registration.d.ts +12 -4
- package/dist/src/services/generator-registration.d.ts.map +1 -1
- package/dist/src/services/generator-registration.js +71 -0
- package/dist/src/services/generator-registration.js.map +1 -1
- package/dist/src/services/generator-validate.d.ts +10 -0
- package/dist/src/services/generator-validate.d.ts.map +1 -1
- package/dist/src/services/generator-validate.js +180 -36
- package/dist/src/services/generator-validate.js.map +1 -1
- package/dist/src/services/owner-session.d.ts +43 -0
- package/dist/src/services/owner-session.d.ts.map +1 -0
- package/dist/src/services/owner-session.js +175 -0
- package/dist/src/services/owner-session.js.map +1 -0
- package/dist/src/services/schedule-constraints.d.ts +65 -0
- package/dist/src/services/schedule-constraints.d.ts.map +1 -0
- package/dist/src/services/schedule-constraints.js +106 -0
- package/dist/src/services/schedule-constraints.js.map +1 -0
- package/dist/src/services/scheduler.d.ts +34 -0
- package/dist/src/services/scheduler.d.ts.map +1 -1
- package/dist/src/services/scheduler.js +266 -22
- package/dist/src/services/scheduler.js.map +1 -1
- package/dist/src/services/skill-bundle/generator.js +19 -0
- package/dist/src/services/skill-bundle/generator.js.map +1 -1
- package/dist/src/storage/interface.d.ts +48 -4
- package/dist/src/storage/interface.d.ts.map +1 -1
- package/dist/src/storage/interface.js.map +1 -1
- package/dist/src/storage/providers/mongodb/index.d.ts +31 -0
- package/dist/src/storage/providers/mongodb/index.d.ts.map +1 -1
- package/dist/src/storage/providers/mongodb/index.js +187 -9
- package/dist/src/storage/providers/mongodb/index.js.map +1 -1
- package/dist/src/storage/providers/sqlite/index.d.ts +31 -0
- package/dist/src/storage/providers/sqlite/index.d.ts.map +1 -1
- package/dist/src/storage/providers/sqlite/index.js +131 -8
- package/dist/src/storage/providers/sqlite/index.js.map +1 -1
- package/dist/src/storage/providers/sqlite/repos/agent-task.d.ts.map +1 -1
- package/dist/src/storage/providers/sqlite/repos/agent-task.js +6 -4
- package/dist/src/storage/providers/sqlite/repos/agent-task.js.map +1 -1
- package/dist/src/storage/providers/sqlite/schema.d.ts.map +1 -1
- package/dist/src/storage/providers/sqlite/schema.js +79 -8
- package/dist/src/storage/providers/sqlite/schema.js.map +1 -1
- package/dist/src/storage/repositories/pat.repository.d.ts +40 -0
- package/dist/src/storage/repositories/pat.repository.d.ts.map +1 -0
- package/dist/src/storage/repositories/pat.repository.js +14 -0
- package/dist/src/storage/repositories/pat.repository.js.map +1 -0
- package/dist/src/storage/repositories/scheduler.repository.d.ts +2 -0
- package/dist/src/storage/repositories/scheduler.repository.d.ts.map +1 -1
- package/dist/src/storage/repositories/session.repository.d.ts +51 -0
- package/dist/src/storage/repositories/session.repository.d.ts.map +1 -1
- package/dist/src/storage/repositories/session.repository.js +12 -0
- package/dist/src/storage/repositories/session.repository.js.map +1 -1
- package/dist/src/utils/env-config.d.ts.map +1 -1
- package/dist/src/utils/env-config.js +25 -1
- package/dist/src/utils/env-config.js.map +1 -1
- package/dist/src/utils/env-validator.d.ts.map +1 -1
- package/dist/src/utils/env-validator.js +4 -0
- package/dist/src/utils/env-validator.js.map +1 -1
- package/package.json +1 -1
- package/prisma/schema.prisma +48 -0
|
@@ -195,6 +195,8 @@ export class MongoStorage {
|
|
|
195
195
|
languages: agent.languages ?? null,
|
|
196
196
|
mode: agent.mode ?? 'interactive',
|
|
197
197
|
maxConcurrentTasks: agent.maxConcurrentTasks ?? 1,
|
|
198
|
+
dailySpendLimit: agent.dailySpendLimit ?? null,
|
|
199
|
+
scheduleConstraintDefaults: agent.scheduleConstraintDefaults ?? null,
|
|
198
200
|
webhookUrl: agent.webhookUrl ?? null,
|
|
199
201
|
webhookSecret: agent.webhookSecret ?? null,
|
|
200
202
|
webhookEnabled: agent.webhookEnabled ?? false,
|
|
@@ -1432,7 +1434,7 @@ export class MongoStorage {
|
|
|
1432
1434
|
return { name: row.name, displayName: row.displayName ?? undefined, publicKey: row.publicKey, roles: row.roles, createdAt: row.createdAt.toISOString() };
|
|
1433
1435
|
}
|
|
1434
1436
|
toAgentRecord(row) {
|
|
1435
|
-
return { name: row.name, owner: row.owner, gaii: row.gaii, displayName: row.displayName ?? undefined, description: row.description ?? undefined, capabilities: row.capabilities, publicKey: row.publicKey, trustScore: row.trustScore, morselBalance: row.morselBalance, defaultScopes: row.defaultScopes?.length ? row.defaultScopes : undefined, allowedOrigins: row.allowedOrigins?.length ? row.allowedOrigins : undefined, federate: row.federate ?? false, technicalCapabilities: row.technicalCapabilities ?? undefined, domainCapabilities: row.domainCapabilities ?? undefined, languages: row.languages ?? undefined, activityStats: row.activityStats ?? undefined, modulesLoaded: row.modulesLoaded ?? undefined, agentLimitations: row.agentLimitations ?? undefined, webhookUrl: row.webhookUrl ?? undefined, webhookSecret: row.webhookSecret ?? undefined, webhookEnabled: row.webhookEnabled ?? false, webhookLastSuccess: row.webhookLastSuccess ? row.webhookLastSuccess.toISOString() : undefined, webhookLastFailure: row.webhookLastFailure ? row.webhookLastFailure.toISOString() : undefined, webhookFailCount: row.webhookFailCount ?? 0, platform: row.platform ?? undefined, platformVersion: row.platformVersion ?? undefined, platformDetectedBy: row.platformDetectedBy ?? undefined, tags: row.tags?.length ? row.tags : undefined, mode: (row.mode ?? 'interactive'), maxConcurrentTasks: row.maxConcurrentTasks ?? 1, createdAt: row.createdAt.toISOString(), lastSeen: row.lastSeen.toISOString() };
|
|
1437
|
+
return { name: row.name, owner: row.owner, gaii: row.gaii, displayName: row.displayName ?? undefined, description: row.description ?? undefined, capabilities: row.capabilities, publicKey: row.publicKey, trustScore: row.trustScore, morselBalance: row.morselBalance, defaultScopes: row.defaultScopes?.length ? row.defaultScopes : undefined, allowedOrigins: row.allowedOrigins?.length ? row.allowedOrigins : undefined, federate: row.federate ?? false, technicalCapabilities: row.technicalCapabilities ?? undefined, domainCapabilities: row.domainCapabilities ?? undefined, languages: row.languages ?? undefined, activityStats: row.activityStats ?? undefined, modulesLoaded: row.modulesLoaded ?? undefined, agentLimitations: row.agentLimitations ?? undefined, webhookUrl: row.webhookUrl ?? undefined, webhookSecret: row.webhookSecret ?? undefined, webhookEnabled: row.webhookEnabled ?? false, webhookLastSuccess: row.webhookLastSuccess ? row.webhookLastSuccess.toISOString() : undefined, webhookLastFailure: row.webhookLastFailure ? row.webhookLastFailure.toISOString() : undefined, webhookFailCount: row.webhookFailCount ?? 0, platform: row.platform ?? undefined, platformVersion: row.platformVersion ?? undefined, platformDetectedBy: row.platformDetectedBy ?? undefined, tags: row.tags?.length ? row.tags : undefined, mode: (row.mode ?? 'interactive'), maxConcurrentTasks: row.maxConcurrentTasks ?? 1, dailySpendLimit: row.dailySpendLimit ?? undefined, scheduleConstraintDefaults: row.scheduleConstraintDefaults ?? undefined, createdAt: row.createdAt.toISOString(), lastSeen: row.lastSeen.toISOString() };
|
|
1436
1438
|
}
|
|
1437
1439
|
toMemoryRecord(row) {
|
|
1438
1440
|
return { key: row.key, ownerGaii: row.ownerGaii, value: row.value, visibility: row.visibility, groupId: row.groupId ?? undefined, tags: row.tags, ttlHours: row.ttlHours, version: row.version, createdAt: row.createdAt.toISOString(), updatedAt: row.updatedAt.toISOString(), flagCount: row.flagCount ?? undefined, allowedOrigins: row.allowedOrigins?.length ? row.allowedOrigins : undefined };
|
|
@@ -3370,6 +3372,25 @@ export class MongoStorage {
|
|
|
3370
3372
|
await this.prisma.notificationTemplate.deleteMany();
|
|
3371
3373
|
}
|
|
3372
3374
|
// ── Sessions (P3-7: Server-Side Session Tracking) ──────────
|
|
3375
|
+
mapPrismaSession(s) {
|
|
3376
|
+
const iso = (d) => d == null ? null : (d instanceof Date ? d.toISOString() : String(d));
|
|
3377
|
+
return {
|
|
3378
|
+
sessionId: s.sessionId,
|
|
3379
|
+
gaii: s.gaii,
|
|
3380
|
+
owner: s.owner,
|
|
3381
|
+
issuedAt: iso(s.issuedAt),
|
|
3382
|
+
expiresAt: iso(s.expiresAt),
|
|
3383
|
+
revoked: s.revoked,
|
|
3384
|
+
refreshTokenHash: s.refreshTokenHash ?? null,
|
|
3385
|
+
prevTokenHash: s.prevTokenHash ?? null,
|
|
3386
|
+
prevValidUntil: iso(s.prevValidUntil),
|
|
3387
|
+
lastUsedAt: iso(s.lastUsedAt),
|
|
3388
|
+
idleExpiresAt: iso(s.idleExpiresAt),
|
|
3389
|
+
absoluteExpiresAt: iso(s.absoluteExpiresAt),
|
|
3390
|
+
deviceLabel: s.deviceLabel ?? null,
|
|
3391
|
+
userAgent: s.userAgent ?? null,
|
|
3392
|
+
};
|
|
3393
|
+
}
|
|
3373
3394
|
async createSession(session) {
|
|
3374
3395
|
this.ensureReady();
|
|
3375
3396
|
await this.prisma.session.create({
|
|
@@ -3383,20 +3404,54 @@ export class MongoStorage {
|
|
|
3383
3404
|
},
|
|
3384
3405
|
});
|
|
3385
3406
|
}
|
|
3407
|
+
async createOwnerSession(session) {
|
|
3408
|
+
this.ensureReady();
|
|
3409
|
+
await this.prisma.session.create({
|
|
3410
|
+
data: {
|
|
3411
|
+
sessionId: session.sessionId,
|
|
3412
|
+
gaii: session.gaii,
|
|
3413
|
+
owner: session.owner,
|
|
3414
|
+
issuedAt: new Date(session.issuedAt),
|
|
3415
|
+
// expiresAt mirrors the idle window so listActiveSessions reflects refresh-token life.
|
|
3416
|
+
expiresAt: new Date(session.idleExpiresAt),
|
|
3417
|
+
revoked: false,
|
|
3418
|
+
refreshTokenHash: session.refreshTokenHash,
|
|
3419
|
+
idleExpiresAt: new Date(session.idleExpiresAt),
|
|
3420
|
+
absoluteExpiresAt: new Date(session.absoluteExpiresAt),
|
|
3421
|
+
lastUsedAt: new Date(session.lastUsedAt),
|
|
3422
|
+
deviceLabel: session.deviceLabel ?? null,
|
|
3423
|
+
userAgent: session.userAgent ?? null,
|
|
3424
|
+
},
|
|
3425
|
+
});
|
|
3426
|
+
}
|
|
3386
3427
|
async listActiveSessions(owner) {
|
|
3387
3428
|
this.ensureReady();
|
|
3388
3429
|
const sessions = await this.prisma.session.findMany({
|
|
3389
3430
|
where: { owner, revoked: false },
|
|
3390
3431
|
orderBy: { issuedAt: 'desc' },
|
|
3391
3432
|
});
|
|
3392
|
-
return sessions.map((s) => (
|
|
3393
|
-
|
|
3394
|
-
|
|
3395
|
-
|
|
3396
|
-
|
|
3397
|
-
|
|
3398
|
-
|
|
3399
|
-
|
|
3433
|
+
return sessions.map((s) => this.mapPrismaSession(s));
|
|
3434
|
+
}
|
|
3435
|
+
async getSessionByRefreshHash(tokenHash) {
|
|
3436
|
+
this.ensureReady();
|
|
3437
|
+
const s = await this.prisma.session.findFirst({
|
|
3438
|
+
where: { OR: [{ refreshTokenHash: tokenHash }, { prevTokenHash: tokenHash }] },
|
|
3439
|
+
});
|
|
3440
|
+
return s ? this.mapPrismaSession(s) : null;
|
|
3441
|
+
}
|
|
3442
|
+
async rotateSessionRefresh(sessionId, update) {
|
|
3443
|
+
this.ensureReady();
|
|
3444
|
+
await this.prisma.session.update({
|
|
3445
|
+
where: { sessionId },
|
|
3446
|
+
data: {
|
|
3447
|
+
refreshTokenHash: update.refreshTokenHash,
|
|
3448
|
+
prevTokenHash: update.prevTokenHash,
|
|
3449
|
+
prevValidUntil: update.prevValidUntil ? new Date(update.prevValidUntil) : null,
|
|
3450
|
+
idleExpiresAt: new Date(update.idleExpiresAt),
|
|
3451
|
+
expiresAt: new Date(update.expiresAt),
|
|
3452
|
+
lastUsedAt: new Date(update.lastUsedAt),
|
|
3453
|
+
},
|
|
3454
|
+
});
|
|
3400
3455
|
}
|
|
3401
3456
|
async revokeSession(sessionId) {
|
|
3402
3457
|
this.ensureReady();
|
|
@@ -3421,6 +3476,80 @@ export class MongoStorage {
|
|
|
3421
3476
|
return false;
|
|
3422
3477
|
return session.revoked;
|
|
3423
3478
|
}
|
|
3479
|
+
async pruneExpiredSessions(nowIso) {
|
|
3480
|
+
this.ensureReady();
|
|
3481
|
+
const now = new Date(nowIso);
|
|
3482
|
+
// Remove fully-dead rows; keep revoked-but-unexpired rows so isSessionRevoked
|
|
3483
|
+
// still rejects their short-lived access tokens.
|
|
3484
|
+
const result = await this.prisma.session.deleteMany({
|
|
3485
|
+
where: { OR: [{ expiresAt: { lt: now } }, { absoluteExpiresAt: { lt: now } }] },
|
|
3486
|
+
});
|
|
3487
|
+
return result.count;
|
|
3488
|
+
}
|
|
3489
|
+
// ── Personal Access Tokens ────────────────────────────────
|
|
3490
|
+
mapPat(p) {
|
|
3491
|
+
const iso = (d) => d == null ? null : (d instanceof Date ? d.toISOString() : String(d));
|
|
3492
|
+
return {
|
|
3493
|
+
id: p.id,
|
|
3494
|
+
tokenHash: p.tokenHash,
|
|
3495
|
+
label: p.label,
|
|
3496
|
+
owner: p.owner,
|
|
3497
|
+
scopes: p.scopes ?? [],
|
|
3498
|
+
grantOwner: p.grantOwner,
|
|
3499
|
+
grantOperator: p.grantOperator,
|
|
3500
|
+
readOwnerData: p.readOwnerData,
|
|
3501
|
+
gaii: p.gaii,
|
|
3502
|
+
createdAt: iso(p.createdAt),
|
|
3503
|
+
expiresAt: iso(p.expiresAt),
|
|
3504
|
+
lastUsedAt: iso(p.lastUsedAt),
|
|
3505
|
+
revoked: p.revoked,
|
|
3506
|
+
};
|
|
3507
|
+
}
|
|
3508
|
+
async createPat(pat) {
|
|
3509
|
+
this.ensureReady();
|
|
3510
|
+
await this.prisma.personalAccessToken.create({
|
|
3511
|
+
data: {
|
|
3512
|
+
id: pat.id,
|
|
3513
|
+
tokenHash: pat.tokenHash,
|
|
3514
|
+
label: pat.label,
|
|
3515
|
+
owner: pat.owner,
|
|
3516
|
+
scopes: pat.scopes ?? [],
|
|
3517
|
+
grantOwner: pat.grantOwner,
|
|
3518
|
+
grantOperator: pat.grantOperator,
|
|
3519
|
+
readOwnerData: pat.readOwnerData,
|
|
3520
|
+
gaii: pat.gaii,
|
|
3521
|
+
createdAt: new Date(pat.createdAt),
|
|
3522
|
+
expiresAt: pat.expiresAt ? new Date(pat.expiresAt) : null,
|
|
3523
|
+
lastUsedAt: pat.lastUsedAt ? new Date(pat.lastUsedAt) : null,
|
|
3524
|
+
revoked: false,
|
|
3525
|
+
},
|
|
3526
|
+
});
|
|
3527
|
+
}
|
|
3528
|
+
async getPatByHash(tokenHash) {
|
|
3529
|
+
this.ensureReady();
|
|
3530
|
+
const p = await this.prisma.personalAccessToken.findFirst({ where: { tokenHash, revoked: false } });
|
|
3531
|
+
return p ? this.mapPat(p) : null;
|
|
3532
|
+
}
|
|
3533
|
+
async listPats(owner) {
|
|
3534
|
+
this.ensureReady();
|
|
3535
|
+
const pats = await this.prisma.personalAccessToken.findMany({
|
|
3536
|
+
where: { owner, revoked: false },
|
|
3537
|
+
orderBy: { createdAt: 'desc' },
|
|
3538
|
+
});
|
|
3539
|
+
return pats.map((p) => this.mapPat(p));
|
|
3540
|
+
}
|
|
3541
|
+
async revokePat(id, owner) {
|
|
3542
|
+
this.ensureReady();
|
|
3543
|
+
const existing = await this.prisma.personalAccessToken.findFirst({ where: { id, owner, revoked: false } });
|
|
3544
|
+
if (!existing)
|
|
3545
|
+
return false;
|
|
3546
|
+
await this.prisma.personalAccessToken.update({ where: { id }, data: { revoked: true } });
|
|
3547
|
+
return true;
|
|
3548
|
+
}
|
|
3549
|
+
async touchPat(id, usedAtIso) {
|
|
3550
|
+
this.ensureReady();
|
|
3551
|
+
await this.prisma.personalAccessToken.update({ where: { id }, data: { lastUsedAt: new Date(usedAtIso) } });
|
|
3552
|
+
}
|
|
3424
3553
|
// ── Token Revocation ──────────────────────────────────────
|
|
3425
3554
|
async revokeToken(tokenHash, expiresAt) {
|
|
3426
3555
|
this.ensureReady();
|
|
@@ -3843,6 +3972,16 @@ export class MongoStorage {
|
|
|
3843
3972
|
createdBy: row.createdBy,
|
|
3844
3973
|
createdAt: row.createdAt instanceof Date ? row.createdAt.toISOString() : row.createdAt,
|
|
3845
3974
|
updatedAt: row.updatedAt instanceof Date ? row.updatedAt.toISOString() : row.updatedAt,
|
|
3975
|
+
ownerScope: row.ownerScope ?? undefined,
|
|
3976
|
+
agentName: row.agentName ?? undefined,
|
|
3977
|
+
agentGaii: row.agentGaii ?? undefined,
|
|
3978
|
+
createdByAgent: row.createdByAgent ?? undefined,
|
|
3979
|
+
displayName: row.displayName ?? undefined,
|
|
3980
|
+
description: row.description ?? undefined,
|
|
3981
|
+
purpose: row.purpose ?? undefined,
|
|
3982
|
+
timezone: row.timezone ?? undefined,
|
|
3983
|
+
constraints: row.constraints ?? undefined,
|
|
3984
|
+
runCount: row.runCount ?? undefined,
|
|
3846
3985
|
};
|
|
3847
3986
|
}
|
|
3848
3987
|
async createScheduledJob(record) {
|
|
@@ -3867,6 +4006,16 @@ export class MongoStorage {
|
|
|
3867
4006
|
createdBy: record.createdBy,
|
|
3868
4007
|
createdAt: new Date(record.createdAt),
|
|
3869
4008
|
updatedAt: new Date(record.updatedAt),
|
|
4009
|
+
ownerScope: record.ownerScope,
|
|
4010
|
+
agentName: record.agentName,
|
|
4011
|
+
agentGaii: record.agentGaii,
|
|
4012
|
+
createdByAgent: record.createdByAgent ?? false,
|
|
4013
|
+
displayName: record.displayName,
|
|
4014
|
+
description: record.description,
|
|
4015
|
+
purpose: record.purpose,
|
|
4016
|
+
timezone: record.timezone,
|
|
4017
|
+
constraints: record.constraints,
|
|
4018
|
+
runCount: record.runCount ?? 0,
|
|
3870
4019
|
},
|
|
3871
4020
|
});
|
|
3872
4021
|
return record;
|
|
@@ -3885,6 +4034,10 @@ export class MongoStorage {
|
|
|
3885
4034
|
where.extensionName = filter.extensionName;
|
|
3886
4035
|
if (filter?.enabled !== undefined)
|
|
3887
4036
|
where.enabled = filter.enabled;
|
|
4037
|
+
if (filter?.ownerScope !== undefined)
|
|
4038
|
+
where.ownerScope = filter.ownerScope;
|
|
4039
|
+
if (filter?.agentGaii !== undefined)
|
|
4040
|
+
where.agentGaii = filter.agentGaii;
|
|
3888
4041
|
const rows = await this.prisma.scheduledJob.findMany({ where });
|
|
3889
4042
|
return rows.map((r) => this.toScheduledJobRecord(r));
|
|
3890
4043
|
}
|
|
@@ -3922,6 +4075,26 @@ export class MongoStorage {
|
|
|
3922
4075
|
data.lastRunDurationMs = updates.lastRunDurationMs;
|
|
3923
4076
|
if (updates.nextRunAt !== undefined)
|
|
3924
4077
|
data.nextRunAt = updates.nextRunAt ? new Date(updates.nextRunAt) : null;
|
|
4078
|
+
if (updates.ownerScope !== undefined)
|
|
4079
|
+
data.ownerScope = updates.ownerScope;
|
|
4080
|
+
if (updates.agentName !== undefined)
|
|
4081
|
+
data.agentName = updates.agentName;
|
|
4082
|
+
if (updates.agentGaii !== undefined)
|
|
4083
|
+
data.agentGaii = updates.agentGaii;
|
|
4084
|
+
if (updates.createdByAgent !== undefined)
|
|
4085
|
+
data.createdByAgent = updates.createdByAgent;
|
|
4086
|
+
if (updates.displayName !== undefined)
|
|
4087
|
+
data.displayName = updates.displayName;
|
|
4088
|
+
if (updates.description !== undefined)
|
|
4089
|
+
data.description = updates.description;
|
|
4090
|
+
if (updates.purpose !== undefined)
|
|
4091
|
+
data.purpose = updates.purpose;
|
|
4092
|
+
if (updates.timezone !== undefined)
|
|
4093
|
+
data.timezone = updates.timezone;
|
|
4094
|
+
if (updates.constraints !== undefined)
|
|
4095
|
+
data.constraints = updates.constraints;
|
|
4096
|
+
if (updates.runCount !== undefined)
|
|
4097
|
+
data.runCount = updates.runCount;
|
|
3925
4098
|
const row = await this.prisma.scheduledJob.update({ where: { id }, data });
|
|
3926
4099
|
return this.toScheduledJobRecord(row);
|
|
3927
4100
|
}
|
|
@@ -3949,6 +4122,7 @@ export class MongoStorage {
|
|
|
3949
4122
|
durationMs: entry.durationMs,
|
|
3950
4123
|
memoryReads: entry.memoryReads,
|
|
3951
4124
|
memoryWrites: entry.memoryWrites,
|
|
4125
|
+
taskId: entry.taskId,
|
|
3952
4126
|
createdAt: new Date(entry.createdAt),
|
|
3953
4127
|
},
|
|
3954
4128
|
});
|
|
@@ -4007,6 +4181,7 @@ export class MongoStorage {
|
|
|
4007
4181
|
durationMs: row.durationMs,
|
|
4008
4182
|
memoryReads: Array.isArray(row.memoryReads) ? row.memoryReads : JSON.parse(row.memoryReads || '[]'),
|
|
4009
4183
|
memoryWrites: Array.isArray(row.memoryWrites) ? row.memoryWrites : JSON.parse(row.memoryWrites || '[]'),
|
|
4184
|
+
taskId: row.taskId ?? undefined,
|
|
4010
4185
|
createdAt: row.createdAt instanceof Date ? row.createdAt.toISOString() : row.createdAt,
|
|
4011
4186
|
};
|
|
4012
4187
|
}
|
|
@@ -5455,6 +5630,7 @@ export class MongoStorage {
|
|
|
5455
5630
|
completedAt: row.completedAt ? (row.completedAt instanceof Date ? row.completedAt.toISOString() : row.completedAt) : undefined,
|
|
5456
5631
|
deliverableKey: row.deliverableKey ?? undefined,
|
|
5457
5632
|
rating: row.rating ?? undefined,
|
|
5633
|
+
triage: (row.triage ?? undefined),
|
|
5458
5634
|
};
|
|
5459
5635
|
}
|
|
5460
5636
|
toTaskEventRecord(row) {
|
|
@@ -5490,6 +5666,7 @@ export class MongoStorage {
|
|
|
5490
5666
|
completedAt: record.completedAt ? new Date(record.completedAt) : null,
|
|
5491
5667
|
deliverableKey: record.deliverableKey ?? null,
|
|
5492
5668
|
rating: record.rating ?? null,
|
|
5669
|
+
triage: record.triage ?? null,
|
|
5493
5670
|
},
|
|
5494
5671
|
});
|
|
5495
5672
|
return record;
|
|
@@ -5569,6 +5746,7 @@ export class MongoStorage {
|
|
|
5569
5746
|
completedAt: merged.completedAt ? new Date(merged.completedAt) : null,
|
|
5570
5747
|
deliverableKey: merged.deliverableKey ?? null,
|
|
5571
5748
|
rating: merged.rating ?? null,
|
|
5749
|
+
triage: merged.triage ?? null,
|
|
5572
5750
|
},
|
|
5573
5751
|
});
|
|
5574
5752
|
return this.toTaskRecord(row);
|