aimeat 1.35.0 → 1.36.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 +25 -0
- package/dist/locales/en.json +6 -2
- package/dist/locales/fi.json +6 -2
- package/dist/public/spa.html +5 -1
- package/dist/public/views/my-company.js +13 -1
- package/dist/public/views/secretary.js +13 -0
- package/dist/scripts/archive-stale-versions.d.ts +33 -0
- package/dist/scripts/archive-stale-versions.d.ts.map +1 -0
- package/dist/scripts/archive-stale-versions.js +278 -0
- package/dist/scripts/archive-stale-versions.js.map +1 -0
- package/dist/src/cli/connect/mcp/tools/agent-management.d.ts +4 -1
- package/dist/src/cli/connect/mcp/tools/agent-management.d.ts.map +1 -1
- package/dist/src/cli/connect/mcp/tools/agent-management.js +1 -1
- package/dist/src/cli/connect/mcp/tools/agent-management.js.map +1 -1
- package/dist/src/config.d.ts +11 -0
- package/dist/src/config.d.ts.map +1 -1
- package/dist/src/config.js +12 -0
- package/dist/src/config.js.map +1 -1
- package/dist/src/generated/api-types.d.ts +439 -2
- package/dist/src/generated/api-types.d.ts.map +1 -1
- package/dist/src/generated/prisma-postgres/edge.js +4 -3
- package/dist/src/generated/prisma-postgres/index-browser.js +1 -0
- package/dist/src/generated/prisma-postgres/index.d.ts +24 -1
- package/dist/src/generated/prisma-postgres/index.js +4 -3
- package/dist/src/generated/prisma-postgres/package.json +1 -1
- package/dist/src/generated/prisma-postgres/schema.prisma +1 -0
- package/dist/src/generated/prisma-postgres/wasm.js +4 -3
- package/dist/src/mcp/workspaces.d.ts +4 -0
- package/dist/src/mcp/workspaces.d.ts.map +1 -1
- package/dist/src/mcp/workspaces.js +16 -3
- package/dist/src/mcp/workspaces.js.map +1 -1
- package/dist/src/routes/agents.d.ts +7 -0
- package/dist/src/routes/agents.d.ts.map +1 -1
- package/dist/src/routes/agents.js +48 -5
- package/dist/src/routes/agents.js.map +1 -1
- package/dist/src/routes/libs.d.ts +14 -0
- package/dist/src/routes/libs.d.ts.map +1 -1
- package/dist/src/routes/libs.js +56 -17
- package/dist/src/routes/libs.js.map +1 -1
- package/dist/src/routes/oauth-login.d.ts +26 -21
- package/dist/src/routes/oauth-login.d.ts.map +1 -1
- package/dist/src/routes/oauth-login.js +257 -229
- package/dist/src/routes/oauth-login.js.map +1 -1
- package/dist/src/routes/openrouter.d.ts +3 -0
- package/dist/src/routes/openrouter.d.ts.map +1 -1
- package/dist/src/routes/openrouter.js +10 -5
- package/dist/src/routes/openrouter.js.map +1 -1
- package/dist/src/routes/organisms.d.ts +4 -0
- package/dist/src/routes/organisms.d.ts.map +1 -1
- package/dist/src/routes/organisms.js +32 -5
- package/dist/src/routes/organisms.js.map +1 -1
- package/dist/src/routes/site.d.ts +2 -0
- package/dist/src/routes/site.d.ts.map +1 -1
- package/dist/src/routes/site.js +10 -2
- package/dist/src/routes/site.js.map +1 -1
- package/dist/src/server-bootstrap/routes-loader.d.ts.map +1 -1
- package/dist/src/server-bootstrap/routes-loader.js +8 -15
- package/dist/src/server-bootstrap/routes-loader.js.map +1 -1
- package/dist/src/services/ai-completion.d.ts +2 -0
- package/dist/src/services/ai-completion.d.ts.map +1 -1
- package/dist/src/services/ai-completion.js +2 -1
- package/dist/src/services/ai-completion.js.map +1 -1
- package/dist/src/services/config-schema.d.ts.map +1 -1
- package/dist/src/services/config-schema.js +2 -0
- package/dist/src/services/config-schema.js.map +1 -1
- package/dist/src/services/generator-autopilot.d.ts +2 -0
- package/dist/src/services/generator-autopilot.d.ts.map +1 -1
- package/dist/src/services/generator-autopilot.js +3 -1
- package/dist/src/services/generator-autopilot.js.map +1 -1
- package/dist/src/services/notebook-ai.d.ts +2 -0
- package/dist/src/services/notebook-ai.d.ts.map +1 -1
- package/dist/src/services/notebook-ai.js +1 -1
- package/dist/src/services/notebook-ai.js.map +1 -1
- package/dist/src/services/oidc-providers.d.ts +94 -0
- package/dist/src/services/oidc-providers.d.ts.map +1 -0
- package/dist/src/services/oidc-providers.js +181 -0
- package/dist/src/services/oidc-providers.js.map +1 -0
- package/dist/src/services/organism-template.d.ts.map +1 -1
- package/dist/src/services/organism-template.js +3 -1
- package/dist/src/services/organism-template.js.map +1 -1
- package/dist/src/services/scheduler.d.ts.map +1 -1
- package/dist/src/services/scheduler.js +5 -1
- package/dist/src/services/scheduler.js.map +1 -1
- package/dist/src/services/skill-bundle/generator.d.ts +2 -0
- package/dist/src/services/skill-bundle/generator.d.ts.map +1 -1
- package/dist/src/services/skill-bundle/generator.js +3 -1
- package/dist/src/services/skill-bundle/generator.js.map +1 -1
- package/dist/src/storage/interface.d.ts +2 -1
- 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 +1 -0
- package/dist/src/storage/providers/mongodb/index.d.ts.map +1 -1
- package/dist/src/storage/providers/mongodb/index.js +27 -0
- package/dist/src/storage/providers/mongodb/index.js.map +1 -1
- package/dist/src/storage/providers/sqlite/index.d.ts +1 -0
- package/dist/src/storage/providers/sqlite/index.d.ts.map +1 -1
- package/dist/src/storage/providers/sqlite/index.js +18 -4
- package/dist/src/storage/providers/sqlite/index.js.map +1 -1
- package/dist/src/storage/providers/sqlite/schema.d.ts.map +1 -1
- package/dist/src/storage/providers/sqlite/schema.js +6 -0
- package/dist/src/storage/providers/sqlite/schema.js.map +1 -1
- package/dist/src/storage/repositories/identity.repository.d.ts +2 -0
- package/dist/src/storage/repositories/identity.repository.d.ts.map +1 -1
- package/dist/src/utils/env-config.d.ts.map +1 -1
- package/dist/src/utils/env-config.js +11 -0
- package/dist/src/utils/env-config.js.map +1 -1
- package/dist/src/utils/node-descriptor.d.ts.map +1 -1
- package/dist/src/utils/node-descriptor.js +1 -0
- package/dist/src/utils/node-descriptor.js.map +1 -1
- package/package.json +3 -1
- package/prisma/schema.postgres.prisma +1 -0
- package/prisma/schema.prisma +1 -0
package/dist/.env.example
CHANGED
|
@@ -269,6 +269,31 @@ AIMEAT_PORT=40050
|
|
|
269
269
|
# AIMEAT_GOOGLE_OAUTH_CLIENT_SECRET="" # OAuth 2.0 client secret
|
|
270
270
|
# AIMEAT_GOOGLE_OAUTH_REDIRECT_URI="" # default: <baseUrl>/v1/ghii/login/google/callback
|
|
271
271
|
|
|
272
|
+
# ── Social login — Casdoor sign-in (OIDC) ────────────────────
|
|
273
|
+
# Casdoor is an open-source IdP. In its admin: create an Application, add the redirect URI below,
|
|
274
|
+
# then copy the client id/secret here. Casdoor is the authority for its org's accounts, so AIMEAT
|
|
275
|
+
# treats emails it returns as verified (enables link-by-email) — only enable IdPs you trust for that.
|
|
276
|
+
# AIMEAT_CASDOOR_OAUTH_ENABLED=false
|
|
277
|
+
# AIMEAT_CASDOOR_OAUTH_ENDPOINT="" # Casdoor server URL, e.g. https://casdoor.example.com
|
|
278
|
+
# AIMEAT_CASDOOR_OAUTH_CLIENT_ID="" # Application client ID from Casdoor
|
|
279
|
+
# AIMEAT_CASDOOR_OAUTH_CLIENT_SECRET="" # Application client secret from Casdoor
|
|
280
|
+
# AIMEAT_CASDOOR_OAUTH_REDIRECT_URI="" # default: <baseUrl>/v1/ghii/login/casdoor/callback
|
|
281
|
+
|
|
282
|
+
# ── Social login — Microsoft Entra ID sign-in (OIDC) ─────────
|
|
283
|
+
# Register an app (free) at https://entra.microsoft.com → App registrations. Add a "Web" platform
|
|
284
|
+
# with the redirect URI below and create a client secret. TENANT controls who may sign in:
|
|
285
|
+
# • a Directory (tenant) GUID → ONLY that org's members (enterprise gating; AIMEAT also checks the
|
|
286
|
+
# `tid` claim and treats the email as verified so members auto-link).
|
|
287
|
+
# • common → any work/school account AND personal Microsoft accounts (widest).
|
|
288
|
+
# • organizations → any work/school account (any org). • consumers → personal accounts only.
|
|
289
|
+
# Note: for the non-GUID modes strict issuer validation can be finicky; pin a tenant GUID for the
|
|
290
|
+
# most reliable + gated setup.
|
|
291
|
+
# AIMEAT_ENTRA_OAUTH_ENABLED=false
|
|
292
|
+
# AIMEAT_ENTRA_OAUTH_TENANT="common" # tenant GUID | common | organizations | consumers
|
|
293
|
+
# AIMEAT_ENTRA_OAUTH_CLIENT_ID="" # Application (client) ID from the app registration
|
|
294
|
+
# AIMEAT_ENTRA_OAUTH_CLIENT_SECRET="" # Client secret value from the app registration
|
|
295
|
+
# AIMEAT_ENTRA_OAUTH_REDIRECT_URI="" # default: <baseUrl>/v1/ghii/login/entra/callback
|
|
296
|
+
|
|
272
297
|
# ── Consul (optional fleet management) ───────────────────────
|
|
273
298
|
# Connect to HashiCorp Consul for centralized config management across nodes.
|
|
274
299
|
# Values in Consul KV take precedence over file/.env but below database overrides.
|
package/dist/locales/en.json
CHANGED
|
@@ -4947,6 +4947,8 @@
|
|
|
4947
4947
|
"cancelBtn": "Cancel",
|
|
4948
4948
|
"orLabel": "OR",
|
|
4949
4949
|
"googleSignIn": "Continue with Google",
|
|
4950
|
+
"casdoorSignIn": "Continue with Casdoor",
|
|
4951
|
+
"entraSignIn": "Continue with Microsoft",
|
|
4950
4952
|
"working": "Working...",
|
|
4951
4953
|
"errUserShort": "Username must be at least 3 characters",
|
|
4952
4954
|
"errPassShort": "Password must be at least 4 characters",
|
|
@@ -4979,11 +4981,13 @@
|
|
|
4979
4981
|
"sendUsername": "Send My Username",
|
|
4980
4982
|
"usernameSent": "If an account with that email exists, your username was sent.",
|
|
4981
4983
|
"signupTitle": "Choose your username",
|
|
4982
|
-
"signupIntro": "You're signing in
|
|
4984
|
+
"signupIntro": "You're signing in for the first time. Pick the username for your AIMEAT account.",
|
|
4983
4985
|
"signupEmailNote": "Signing up as {email}",
|
|
4984
4986
|
"signupUsernameLabel": "Username",
|
|
4985
|
-
"signupSuggestedHint": "We suggested one from your
|
|
4987
|
+
"signupSuggestedHint": "We suggested one from your account — change it to anything you like.",
|
|
4986
4988
|
"signupPermanentWarning": "⚠️ This username is permanent. It identifies you across AIMEAT and cannot be changed later — the only way to change it is to delete your account and create a new one.",
|
|
4989
|
+
"signupDisplayNameLabel": "Display name",
|
|
4990
|
+
"signupDisplayNameHint": "Shown to others — not permanent, you can change it anytime later.",
|
|
4987
4991
|
"signupAvailable": "✓ Available",
|
|
4988
4992
|
"signupTaken": "That username is already taken — pick another.",
|
|
4989
4993
|
"signupInvalid": "Username must be 3–64 characters: lowercase letters, numbers and hyphens.",
|
package/dist/locales/fi.json
CHANGED
|
@@ -4947,6 +4947,8 @@
|
|
|
4947
4947
|
"cancelBtn": "Peruuta",
|
|
4948
4948
|
"orLabel": "TAI",
|
|
4949
4949
|
"googleSignIn": "Jatka Googlella",
|
|
4950
|
+
"casdoorSignIn": "Jatka Casdoorilla",
|
|
4951
|
+
"entraSignIn": "Jatka Microsoftilla",
|
|
4950
4952
|
"working": "Käsitellään...",
|
|
4951
4953
|
"errUserShort": "Käyttäjänimen tulee olla vähintään 3 merkkiä",
|
|
4952
4954
|
"errPassShort": "Salasanan tulee olla vähintään 4 merkkiä",
|
|
@@ -4979,11 +4981,13 @@
|
|
|
4979
4981
|
"sendUsername": "Lähetä käyttäjätunnukseni",
|
|
4980
4982
|
"usernameSent": "Jos sähköpostiosoitteella on tili, käyttäjätunnus lähetettiin.",
|
|
4981
4983
|
"signupTitle": "Valitse käyttäjätunnuksesi",
|
|
4982
|
-
"signupIntro": "Kirjaudut
|
|
4984
|
+
"signupIntro": "Kirjaudut ensimmäistä kertaa. Valitse AIMEAT-tilisi käyttäjätunnus.",
|
|
4983
4985
|
"signupEmailNote": "Rekisteröidyt osoitteella {email}",
|
|
4984
4986
|
"signupUsernameLabel": "Käyttäjätunnus",
|
|
4985
|
-
"signupSuggestedHint": "Ehdotimme tunnusta
|
|
4987
|
+
"signupSuggestedHint": "Ehdotimme tunnusta tilisi perusteella — voit vaihtaa sen mihin tahansa.",
|
|
4986
4988
|
"signupPermanentWarning": "⚠️ Tämä käyttäjätunnus on pysyvä. Se tunnistaa sinut koko AIMEATissa eikä sitä voi vaihtaa jälkikäteen — ainoa tapa muuttaa se on poistaa tili ja luoda uusi.",
|
|
4989
|
+
"signupDisplayNameLabel": "Näyttönimi",
|
|
4990
|
+
"signupDisplayNameHint": "Näkyy muille — ei pysyvä, voit vaihtaa sen milloin tahansa myöhemmin.",
|
|
4987
4991
|
"signupAvailable": "✓ Vapaa",
|
|
4988
4992
|
"signupTaken": "Tämä käyttäjätunnus on jo varattu — valitse toinen.",
|
|
4989
4993
|
"signupInvalid": "Käyttäjätunnuksen pituus 3–64 merkkiä: pieniä kirjaimia, numeroita ja väliviivoja.",
|
package/dist/public/spa.html
CHANGED
|
@@ -544,6 +544,9 @@
|
|
|
544
544
|
const [morsels, setMorsels] = useState(null);
|
|
545
545
|
const [menuOpen, setMenuOpen] = useState(false);
|
|
546
546
|
const [secretaryAvailable, setSecretaryAvailable] = useState(false);
|
|
547
|
+
// Node feature flags from /v1/site/header-nav (e.g. { secretary }). Empty until the fetch resolves,
|
|
548
|
+
// so optional surfaces stay hidden until we positively learn they're enabled (no flash).
|
|
549
|
+
const [features, setFeatures] = useState({});
|
|
547
550
|
// Header nav config: { order, hidden }. Defaults to all visible in declared order
|
|
548
551
|
// until the public /v1/site/header-nav fetch resolves (no flash of empty nav).
|
|
549
552
|
const [navConfig, setNavConfig] = useState({ order: PUBLIC_NAV_LINKS.map(l => l.id), hidden: [] });
|
|
@@ -574,6 +577,7 @@
|
|
|
574
577
|
const order = Array.isArray(d.data.order) ? d.data.order : PUBLIC_NAV_LINKS.map(l => l.id);
|
|
575
578
|
const hidden = Array.isArray(d.data.hidden) ? d.data.hidden : [];
|
|
576
579
|
setNavConfig({ order, hidden });
|
|
580
|
+
setFeatures(d.data.features || {});
|
|
577
581
|
})
|
|
578
582
|
.catch(e => console.warn('Header nav fetch failed:', e.message));
|
|
579
583
|
return () => { cancelled = true; };
|
|
@@ -644,7 +648,7 @@
|
|
|
644
648
|
class="${link.matchActive !== false && currentPath === link.path ? 'active' : ''}">${t(link.key) || link.fallback || link.key}</a>
|
|
645
649
|
`)}
|
|
646
650
|
${session && html`
|
|
647
|
-
${secretaryAvailable && html`
|
|
651
|
+
${secretaryAvailable && features.secretary && html`
|
|
648
652
|
<a href="/v1/secretary" class="sec-nav-link ${currentPath === '/v1/secretary' ? 'active' : ''}"
|
|
649
653
|
title=${t('nav.secretary')} onClick=${(e) => { handleNav(e, '/v1/secretary'); setMenuOpen(false); }}>
|
|
650
654
|
<span class="sec-nav-icon"><svg viewBox="0 0 24 24" aria-hidden="true">
|
|
@@ -22,6 +22,8 @@
|
|
|
22
22
|
* (revenue / orders / cost-per-task / commission income + per-agent table) from GET /v1/orgs/:slug/governance.
|
|
23
23
|
* v0.7.0 — 2026-06-24 — Secretary Phase 6 (slice 1): Company model admin subtab — prompt-driven builder
|
|
24
24
|
* (describe → generate in-app / copy-prompt → review → apply) for departments/roles/people/reporting (GET/PUT /v1/orgs/:slug/model).
|
|
25
|
+
* v0.8.0 — 2026-07-01 — Company Secretary subtab hidden unless the node enables the Secretary feature
|
|
26
|
+
* (AIMEAT_SECRETARY_ENABLED, read from /v1/site/header-nav `features.secretary`). Governance + model unaffected.
|
|
25
27
|
*/
|
|
26
28
|
import { h } from 'preact';
|
|
27
29
|
import { useState, useEffect, useCallback } from 'preact/hooks';
|
|
@@ -760,6 +762,7 @@ export default function MyCompanyView() {
|
|
|
760
762
|
const [newName, setNewName] = useState('');
|
|
761
763
|
const [newBusinessId, setNewBusinessId] = useState('');
|
|
762
764
|
const [busy, setBusy] = useState(false);
|
|
765
|
+
const [featSecretary, setFeatSecretary] = useState(false); // node opt-in: show the company Secretary subtab
|
|
763
766
|
|
|
764
767
|
async function loadOrgs() {
|
|
765
768
|
setState('loading');
|
|
@@ -771,6 +774,15 @@ export default function MyCompanyView() {
|
|
|
771
774
|
}
|
|
772
775
|
}
|
|
773
776
|
useEffect(() => { loadOrgs(); }, []);
|
|
777
|
+
// Company Secretary is opt-in per node (AIMEAT_SECRETARY_ENABLED); hide its admin subtab when off.
|
|
778
|
+
useEffect(() => {
|
|
779
|
+
let cancelled = false;
|
|
780
|
+
fetch('/v1/site/header-nav')
|
|
781
|
+
.then(r => r.json())
|
|
782
|
+
.then(d => { if (!cancelled && d?.ok) setFeatSecretary(!!(d.data?.features && d.data.features.secretary)); })
|
|
783
|
+
.catch(() => {});
|
|
784
|
+
return () => { cancelled = true; };
|
|
785
|
+
}, []);
|
|
774
786
|
|
|
775
787
|
async function loadOrders(org) {
|
|
776
788
|
try { const r = await apiGet(`/v1/orgs/${encodeURIComponent(org.slug)}/orders`); setOrdersReceived(r.data?.orders ?? []); }
|
|
@@ -872,7 +884,7 @@ export default function MyCompanyView() {
|
|
|
872
884
|
</div>
|
|
873
885
|
|
|
874
886
|
<div class="mc-subtabs">
|
|
875
|
-
${['catalog', ...(selected.role === 'admin' ? ['orders', 'customers', 'portfolio', 'secretary', 'governance', 'model', 'settings'] : []), 'members'].map(id => html`
|
|
887
|
+
${['catalog', ...(selected.role === 'admin' ? ['orders', 'customers', 'portfolio', ...(featSecretary ? ['secretary'] : []), 'governance', 'model', 'settings'] : []), 'members'].map(id => html`
|
|
876
888
|
<button class="mc-subtab ${subTab === id ? 'active' : ''}" key=${id} onClick=${() => setSubTab(id)}>${t('myCompany.tab' + id.charAt(0).toUpperCase() + id.slice(1))}</button>`)}
|
|
877
889
|
<span class="mc-role-chip">${t('myCompany.role' + (selected.role || 'member').charAt(0).toUpperCase() + (selected.role || 'member').slice(1))}</span>
|
|
878
890
|
</div>
|
|
@@ -11,6 +11,9 @@
|
|
|
11
11
|
* @structure SECRETARY_ICON · SecretaryView (default) — state, effects, handlers, layout (cards in ./secretary/cards.js + ./secretary/cards-reach.js + dashboard chrome in ./secretary/dashboard.js)
|
|
12
12
|
* @usage routed at /v1/secretary by spa.html (+ portal.ts spaRoutes).
|
|
13
13
|
* @version-history
|
|
14
|
+
* v0.26.0 — 2026-07-01 — Opt-in feature: the Secretary is now gated on AIMEAT_SECRETARY_ENABLED (off by
|
|
15
|
+
* default). The header nav link is hidden and this view redirects to /v1/profile when the node has it
|
|
16
|
+
* disabled (flag read from /v1/site/header-nav `features.secretary`).
|
|
14
17
|
* v0.25.0 — 2026-07-01 — Light-vs-heavy seam: setup no longer cheap-authors content (that hallucinated).
|
|
15
18
|
* applyResult now CREATES the workspace structure and then proposes grounded Work Briefs (POST
|
|
16
19
|
* /v1/secretary/brief) the user hands to a Builder (a connected big AI via the appdev MCP tools). Drops
|
|
@@ -131,6 +134,16 @@ export const SECRETARY_ICON = html`
|
|
|
131
134
|
|
|
132
135
|
export default function SecretaryView() {
|
|
133
136
|
useViewCSS('/css/views/secretary.css');
|
|
137
|
+
// Secretary is opt-in per node (AIMEAT_SECRETARY_ENABLED). If it's disabled but this view is reached
|
|
138
|
+
// via a direct URL/bookmark (no nav link is rendered when off), bounce back to the profile.
|
|
139
|
+
useEffect(() => {
|
|
140
|
+
let cancelled = false;
|
|
141
|
+
fetch('/v1/site/header-nav')
|
|
142
|
+
.then(r => r.json())
|
|
143
|
+
.then(d => { if (!cancelled && d?.ok && d.data?.features && d.data.features.secretary === false) window.location.replace('/v1/profile'); })
|
|
144
|
+
.catch(() => {});
|
|
145
|
+
return () => { cancelled = true; };
|
|
146
|
+
}, []);
|
|
134
147
|
const { showToast, ToastContainer } = useToast();
|
|
135
148
|
const [secretary, setSecretary] = useState(undefined); // undefined=loading, null=not provisioned
|
|
136
149
|
const [hasOpenRouterKey, setHasOpenRouterKey] = useState(false); // owner has an OpenRouter key configured
|
|
@@ -0,0 +1,33 @@
|
|
|
1
|
+
#!/usr/bin/env node
|
|
2
|
+
/**
|
|
3
|
+
* @file archive-stale-versions.ts
|
|
4
|
+
* @description One-time, REVERSIBLE cleanup of accumulated workspace-record version bloat. Publishing a
|
|
5
|
+
* workspace record used to append a new `.version.N` on every publish with no change-guard, so a
|
|
6
|
+
* contract agent that re-published the same draft each poll cycle piled up dozens of byte-identical
|
|
7
|
+
* versions per record (concentrated in request queues: mail/research/moodboard/image_requests). The
|
|
8
|
+
* publish path is now guarded (see mcp/workspaces.ts + routes/organisms.ts), so this stops GROWING;
|
|
9
|
+
* this script cleans up what already accrued.
|
|
10
|
+
*
|
|
11
|
+
* It does NOT delete: it flags redundant version rows `archived = 1` (the same reversible soft-archive
|
|
12
|
+
* the organism archive uses) under a shared `archivedRoot` so the whole batch can be restored with
|
|
13
|
+
* --unarchive. A version row is redundant when it is byte-identical to the version immediately before
|
|
14
|
+
* it (by N) — a pure republish that recorded no real change. Every genuine state transition, the
|
|
15
|
+
* first version, and the highest-numbered version (so publish's next-version scan is unaffected) are
|
|
16
|
+
* ALWAYS kept. Document/record spaces that version legitimately have no consecutive duplicates, so
|
|
17
|
+
* nothing there is touched.
|
|
18
|
+
*
|
|
19
|
+
* Read-only by default. `--from-export=<json>` analyses an exported memory dump with no DB at all.
|
|
20
|
+
* Detects the storage provider from .env for the live scan / apply.
|
|
21
|
+
* @usage
|
|
22
|
+
* pnpm versions:stats # live dry-run: what WOULD be archived (per namespace)
|
|
23
|
+
* pnpm versions:stats -- --from-export=dump.json # analyse an export JSON, no DB touched
|
|
24
|
+
* pnpm versions:archive # apply the archive (asks to confirm)
|
|
25
|
+
* pnpm versions:archive -- --force # apply without the prompt
|
|
26
|
+
* pnpm versions:stats -- --unarchive # preview restore; add --apply to restore
|
|
27
|
+
* pnpm versions:archive -- --unarchive --force # restore the whole archived batch
|
|
28
|
+
* @version-history
|
|
29
|
+
* v1.0.0 -- 2026-07-01 -- Initial: reversible consecutive-identical version dedupe (sqlite + mongodb),
|
|
30
|
+
* plus a DB-free --from-export analyser.
|
|
31
|
+
*/
|
|
32
|
+
export {};
|
|
33
|
+
//# sourceMappingURL=archive-stale-versions.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"archive-stale-versions.d.ts","sourceRoot":"","sources":["../../scripts/archive-stale-versions.ts"],"names":[],"mappings":";AACA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA6BG"}
|
|
@@ -0,0 +1,278 @@
|
|
|
1
|
+
#!/usr/bin/env node
|
|
2
|
+
/**
|
|
3
|
+
* @file archive-stale-versions.ts
|
|
4
|
+
* @description One-time, REVERSIBLE cleanup of accumulated workspace-record version bloat. Publishing a
|
|
5
|
+
* workspace record used to append a new `.version.N` on every publish with no change-guard, so a
|
|
6
|
+
* contract agent that re-published the same draft each poll cycle piled up dozens of byte-identical
|
|
7
|
+
* versions per record (concentrated in request queues: mail/research/moodboard/image_requests). The
|
|
8
|
+
* publish path is now guarded (see mcp/workspaces.ts + routes/organisms.ts), so this stops GROWING;
|
|
9
|
+
* this script cleans up what already accrued.
|
|
10
|
+
*
|
|
11
|
+
* It does NOT delete: it flags redundant version rows `archived = 1` (the same reversible soft-archive
|
|
12
|
+
* the organism archive uses) under a shared `archivedRoot` so the whole batch can be restored with
|
|
13
|
+
* --unarchive. A version row is redundant when it is byte-identical to the version immediately before
|
|
14
|
+
* it (by N) — a pure republish that recorded no real change. Every genuine state transition, the
|
|
15
|
+
* first version, and the highest-numbered version (so publish's next-version scan is unaffected) are
|
|
16
|
+
* ALWAYS kept. Document/record spaces that version legitimately have no consecutive duplicates, so
|
|
17
|
+
* nothing there is touched.
|
|
18
|
+
*
|
|
19
|
+
* Read-only by default. `--from-export=<json>` analyses an exported memory dump with no DB at all.
|
|
20
|
+
* Detects the storage provider from .env for the live scan / apply.
|
|
21
|
+
* @usage
|
|
22
|
+
* pnpm versions:stats # live dry-run: what WOULD be archived (per namespace)
|
|
23
|
+
* pnpm versions:stats -- --from-export=dump.json # analyse an export JSON, no DB touched
|
|
24
|
+
* pnpm versions:archive # apply the archive (asks to confirm)
|
|
25
|
+
* pnpm versions:archive -- --force # apply without the prompt
|
|
26
|
+
* pnpm versions:stats -- --unarchive # preview restore; add --apply to restore
|
|
27
|
+
* pnpm versions:archive -- --unarchive --force # restore the whole archived batch
|
|
28
|
+
* @version-history
|
|
29
|
+
* v1.0.0 -- 2026-07-01 -- Initial: reversible consecutive-identical version dedupe (sqlite + mongodb),
|
|
30
|
+
* plus a DB-free --from-export analyser.
|
|
31
|
+
*/
|
|
32
|
+
import { existsSync, readFileSync, statSync } from 'node:fs';
|
|
33
|
+
import { resolve, dirname } from 'node:path';
|
|
34
|
+
import { fileURLToPath } from 'node:url';
|
|
35
|
+
import { createInterface } from 'node:readline';
|
|
36
|
+
const __dirname = dirname(fileURLToPath(import.meta.url));
|
|
37
|
+
const ROOT = resolve(__dirname, '..');
|
|
38
|
+
const ARCHIVE_ROOT = 'stale-version-dedupe';
|
|
39
|
+
const ARCHIVED_BY = 'archive-stale-versions-script';
|
|
40
|
+
function loadEnv() {
|
|
41
|
+
const envPath = resolve(ROOT, '.env');
|
|
42
|
+
const vars = {};
|
|
43
|
+
if (existsSync(envPath)) {
|
|
44
|
+
for (const line of readFileSync(envPath, 'utf8').split('\n')) {
|
|
45
|
+
const m = line.match(/^([A-Z_]+)\s*=\s*"?([^"\n]*)"?/);
|
|
46
|
+
if (m)
|
|
47
|
+
vars[m[1]] = m[2];
|
|
48
|
+
}
|
|
49
|
+
}
|
|
50
|
+
return vars;
|
|
51
|
+
}
|
|
52
|
+
const env = { ...loadEnv(), ...process.env };
|
|
53
|
+
const provider = env.AIMEAT_STORAGE ?? 'memory';
|
|
54
|
+
const argv = process.argv.slice(2);
|
|
55
|
+
const force = argv.includes('--force') || argv.includes('-f');
|
|
56
|
+
const apply = argv.includes('--apply');
|
|
57
|
+
const unarchive = argv.includes('--unarchive');
|
|
58
|
+
const fromExportArg = argv.find(a => a.startsWith('--from-export='));
|
|
59
|
+
const fromExport = fromExportArg ? fromExportArg.split('=').slice(1).join('=') : null;
|
|
60
|
+
function fmtBytes(n) {
|
|
61
|
+
if (n < 1024)
|
|
62
|
+
return `${n} B`;
|
|
63
|
+
if (n < 1024 ** 2)
|
|
64
|
+
return `${(n / 1024).toFixed(1)} KB`;
|
|
65
|
+
if (n < 1024 ** 3)
|
|
66
|
+
return `${(n / 1024 ** 2).toFixed(1)} MB`;
|
|
67
|
+
return `${(n / 1024 ** 3).toFixed(2)} GB`;
|
|
68
|
+
}
|
|
69
|
+
function bytesOf(v) { return Buffer.byteLength(JSON.stringify(v ?? null), 'utf8'); }
|
|
70
|
+
async function confirm(message) {
|
|
71
|
+
if (force)
|
|
72
|
+
return true;
|
|
73
|
+
const rl = createInterface({ input: process.stdin, output: process.stdout });
|
|
74
|
+
const answer = await new Promise(r => rl.question(message, r));
|
|
75
|
+
rl.close();
|
|
76
|
+
return answer.trim().toLowerCase() === 'y';
|
|
77
|
+
}
|
|
78
|
+
/** Namespace label for a workspace record key: the objectType namespace segment, else '(other)'. */
|
|
79
|
+
function nsOf(key) {
|
|
80
|
+
const m = key.match(/\.shared\.([^.]+)\./) || key.match(/\.w\.[^.]+\.([^.]+)\./) || key.match(/^([^.]+)\./);
|
|
81
|
+
return m ? m[1] : '(other)';
|
|
82
|
+
}
|
|
83
|
+
/** Redundant version rows = byte-identical to the version immediately before them (by N), excluding the
|
|
84
|
+
* highest-numbered version of each record (kept so a future publish's maxN scan is unaffected). */
|
|
85
|
+
function planRedundant(rows) {
|
|
86
|
+
const groups = new Map();
|
|
87
|
+
for (const r of rows) {
|
|
88
|
+
const m = r.key.match(/^(.*)\.version\.(\d+)$/);
|
|
89
|
+
if (!m)
|
|
90
|
+
continue;
|
|
91
|
+
const arr = groups.get(m[1]) ?? [];
|
|
92
|
+
arr.push({ n: parseInt(m[2], 10), row: r });
|
|
93
|
+
groups.set(m[1], arr);
|
|
94
|
+
}
|
|
95
|
+
const out = [];
|
|
96
|
+
for (const arr of groups.values()) {
|
|
97
|
+
arr.sort((a, b) => a.n - b.n);
|
|
98
|
+
const maxN = arr[arr.length - 1].n;
|
|
99
|
+
for (let i = 1; i < arr.length; i++) {
|
|
100
|
+
if (arr[i].n === maxN)
|
|
101
|
+
continue; // always keep the top version
|
|
102
|
+
if (JSON.stringify(arr[i].row.value) === JSON.stringify(arr[i - 1].row.value)) {
|
|
103
|
+
out.push({ ...arr[i].row, bytes: bytesOf(arr[i].row.value) }); // identical to its predecessor
|
|
104
|
+
}
|
|
105
|
+
}
|
|
106
|
+
}
|
|
107
|
+
return out;
|
|
108
|
+
}
|
|
109
|
+
function report(redundant, totalVersionRows) {
|
|
110
|
+
const byNs = new Map();
|
|
111
|
+
let bytes = 0;
|
|
112
|
+
for (const r of redundant) {
|
|
113
|
+
const s = byNs.get(nsOf(r.key)) ?? { count: 0, bytes: 0 };
|
|
114
|
+
s.count++;
|
|
115
|
+
s.bytes += r.bytes;
|
|
116
|
+
byNs.set(nsOf(r.key), s);
|
|
117
|
+
bytes += r.bytes;
|
|
118
|
+
}
|
|
119
|
+
console.log(` Version rows scanned: ${totalVersionRows.toLocaleString()}`);
|
|
120
|
+
console.log(` Redundant (archivable): ${redundant.length.toLocaleString()} (${fmtBytes(bytes)})`);
|
|
121
|
+
if (byNs.size) {
|
|
122
|
+
console.log(' By namespace:');
|
|
123
|
+
for (const [ns, s] of [...byNs.entries()].sort((a, b) => b[1].bytes - a[1].bytes)) {
|
|
124
|
+
console.log(` ${ns.padEnd(22)} ${String(s.count).padStart(5)} rows ${fmtBytes(s.bytes).padStart(10)}`);
|
|
125
|
+
}
|
|
126
|
+
}
|
|
127
|
+
console.log('');
|
|
128
|
+
}
|
|
129
|
+
// ─── Export-file analysis (no DB) ────────────────────────────
|
|
130
|
+
function runFromExport(path) {
|
|
131
|
+
const p = resolve(process.cwd(), path);
|
|
132
|
+
if (!existsSync(p)) {
|
|
133
|
+
console.error(` x No export file at ${p}`);
|
|
134
|
+
process.exit(1);
|
|
135
|
+
}
|
|
136
|
+
const doc = JSON.parse(readFileSync(p, 'utf8'));
|
|
137
|
+
const entries = doc.entries ?? [];
|
|
138
|
+
const versionRows = entries.filter(e => /\.version\.\d+$/.test(e.key));
|
|
139
|
+
console.log(` Source: export file (${path}) — read-only, no DB touched`);
|
|
140
|
+
console.log(` Entries: ${entries.length.toLocaleString()}`);
|
|
141
|
+
console.log('');
|
|
142
|
+
report(planRedundant(versionRows), versionRows.length);
|
|
143
|
+
console.log(' This is analysis only. Point the script at the live node (drop --from-export) to apply.');
|
|
144
|
+
}
|
|
145
|
+
// ─── SQLite ──────────────────────────────────────────────────
|
|
146
|
+
async function runSqlite() {
|
|
147
|
+
const dbPath = resolve(ROOT, env.AIMEAT_SQLITE_PATH ?? './data/aimeat.db');
|
|
148
|
+
if (!existsSync(dbPath)) {
|
|
149
|
+
console.log(` No database file at ${dbPath} — nothing to do.`);
|
|
150
|
+
return;
|
|
151
|
+
}
|
|
152
|
+
const Database = (await import('better-sqlite3')).default;
|
|
153
|
+
const db = new Database(dbPath);
|
|
154
|
+
try {
|
|
155
|
+
console.log(` Storage: sqlite (${dbPath})`);
|
|
156
|
+
console.log(` DB file size: ${fmtBytes(statSync(dbPath).size)}`);
|
|
157
|
+
console.log('');
|
|
158
|
+
if (unarchive) {
|
|
159
|
+
const n = db.prepare('SELECT COUNT(*) AS c FROM memory WHERE archivedRoot = ?').get(ARCHIVE_ROOT).c;
|
|
160
|
+
console.log(` Archived batch "${ARCHIVE_ROOT}": ${n.toLocaleString()} row(s).`);
|
|
161
|
+
if (!apply) {
|
|
162
|
+
console.log(' Read-only. Add --apply to restore them.');
|
|
163
|
+
return;
|
|
164
|
+
}
|
|
165
|
+
if (!await confirm(` Restore ${n.toLocaleString()} archived version row(s)? [y/N] `)) {
|
|
166
|
+
console.log(' Aborted.');
|
|
167
|
+
return;
|
|
168
|
+
}
|
|
169
|
+
const res = db.prepare('UPDATE memory SET archived=0, archivedAt=NULL, archivedBy=NULL, archivedRoot=NULL WHERE archivedRoot = ?').run(ARCHIVE_ROOT);
|
|
170
|
+
console.log(` Restored ${res.changes.toLocaleString()} row(s).`);
|
|
171
|
+
return;
|
|
172
|
+
}
|
|
173
|
+
const rows = db.prepare("SELECT key, ownerGaii, value FROM memory WHERE key LIKE '%.version.%' AND archived = 0").all();
|
|
174
|
+
const redundant = planRedundant(rows.map(r => ({ key: r.key, ownerGaii: r.ownerGaii, value: JSON.parse(r.value) })));
|
|
175
|
+
report(redundant, rows.length);
|
|
176
|
+
if (!apply) {
|
|
177
|
+
console.log(' Read-only. Re-run with --apply (pnpm versions:archive) to soft-archive them.');
|
|
178
|
+
return;
|
|
179
|
+
}
|
|
180
|
+
if (redundant.length === 0) {
|
|
181
|
+
console.log(' Nothing to archive.');
|
|
182
|
+
return;
|
|
183
|
+
}
|
|
184
|
+
if (!await confirm(` Soft-archive ${redundant.length.toLocaleString()} redundant version row(s)? Reversible via --unarchive. [y/N] `)) {
|
|
185
|
+
console.log(' Aborted.');
|
|
186
|
+
return;
|
|
187
|
+
}
|
|
188
|
+
const at = new Date().toISOString();
|
|
189
|
+
const stmt = db.prepare('UPDATE memory SET archived=1, archivedAt=?, archivedBy=?, archivedRoot=? WHERE ownerGaii=? AND key=? AND archived=0');
|
|
190
|
+
const tx = db.transaction((items) => {
|
|
191
|
+
let done = 0;
|
|
192
|
+
for (const r of items)
|
|
193
|
+
done += stmt.run(at, ARCHIVED_BY, ARCHIVE_ROOT, r.ownerGaii, r.key).changes;
|
|
194
|
+
return done;
|
|
195
|
+
});
|
|
196
|
+
console.log(` Archived ${tx(redundant).toLocaleString()} row(s) under archivedRoot="${ARCHIVE_ROOT}". Restore with: pnpm versions:archive -- --unarchive --force`);
|
|
197
|
+
}
|
|
198
|
+
finally {
|
|
199
|
+
db.close();
|
|
200
|
+
}
|
|
201
|
+
}
|
|
202
|
+
// ─── MongoDB ─────────────────────────────────────────────────
|
|
203
|
+
async function runMongodb() {
|
|
204
|
+
const dbUrl = env.DATABASE_URL;
|
|
205
|
+
if (!dbUrl) {
|
|
206
|
+
console.error(' x No DATABASE_URL in .env');
|
|
207
|
+
process.exit(1);
|
|
208
|
+
}
|
|
209
|
+
const { PrismaClient } = await import('@prisma/client');
|
|
210
|
+
const prisma = new PrismaClient({ datasourceUrl: dbUrl });
|
|
211
|
+
await prisma.$connect();
|
|
212
|
+
try {
|
|
213
|
+
console.log(' Storage: mongodb');
|
|
214
|
+
console.log('');
|
|
215
|
+
if (unarchive) {
|
|
216
|
+
const n = await prisma.memory.count({ where: { archivedRoot: ARCHIVE_ROOT } });
|
|
217
|
+
console.log(` Archived batch "${ARCHIVE_ROOT}": ${n.toLocaleString()} row(s).`);
|
|
218
|
+
if (!apply) {
|
|
219
|
+
console.log(' Read-only. Add --apply to restore them.');
|
|
220
|
+
return;
|
|
221
|
+
}
|
|
222
|
+
if (!await confirm(` Restore ${n.toLocaleString()} archived version row(s)? [y/N] `)) {
|
|
223
|
+
console.log(' Aborted.');
|
|
224
|
+
return;
|
|
225
|
+
}
|
|
226
|
+
const res = await prisma.memory.updateMany({ where: { archivedRoot: ARCHIVE_ROOT }, data: { archived: false, archivedAt: null, archivedBy: null, archivedRoot: null } });
|
|
227
|
+
console.log(` Restored ${res.count.toLocaleString()} row(s).`);
|
|
228
|
+
return;
|
|
229
|
+
}
|
|
230
|
+
const rows = await prisma.memory.findMany({ where: { key: { contains: '.version.' }, archived: false }, select: { key: true, ownerGaii: true, value: true } });
|
|
231
|
+
const redundant = planRedundant(rows.map(r => ({ key: r.key, ownerGaii: r.ownerGaii, value: r.value })));
|
|
232
|
+
report(redundant, rows.length);
|
|
233
|
+
if (!apply) {
|
|
234
|
+
console.log(' Read-only. Re-run with --apply (pnpm versions:archive) to soft-archive them.');
|
|
235
|
+
return;
|
|
236
|
+
}
|
|
237
|
+
if (redundant.length === 0) {
|
|
238
|
+
console.log(' Nothing to archive.');
|
|
239
|
+
return;
|
|
240
|
+
}
|
|
241
|
+
if (!await confirm(` Soft-archive ${redundant.length.toLocaleString()} redundant version row(s)? Reversible via --unarchive. [y/N] `)) {
|
|
242
|
+
console.log(' Aborted.');
|
|
243
|
+
return;
|
|
244
|
+
}
|
|
245
|
+
const at = new Date();
|
|
246
|
+
let done = 0;
|
|
247
|
+
for (const r of redundant) {
|
|
248
|
+
await prisma.memory.update({ where: { ownerGaii_key: { ownerGaii: r.ownerGaii, key: r.key } }, data: { archived: true, archivedAt: at, archivedBy: ARCHIVED_BY, archivedRoot: ARCHIVE_ROOT } });
|
|
249
|
+
done++;
|
|
250
|
+
}
|
|
251
|
+
console.log(` Archived ${done.toLocaleString()} row(s) under archivedRoot="${ARCHIVE_ROOT}". Restore with: pnpm versions:archive -- --unarchive --force`);
|
|
252
|
+
}
|
|
253
|
+
finally {
|
|
254
|
+
await prisma.$disconnect();
|
|
255
|
+
}
|
|
256
|
+
}
|
|
257
|
+
// ─── Main ────────────────────────────────────────────────────
|
|
258
|
+
console.log('');
|
|
259
|
+
console.log(' AIMEAT Stale-Version Archive (reversible)');
|
|
260
|
+
console.log(' ══════════════════════════════════════════');
|
|
261
|
+
if (fromExport) {
|
|
262
|
+
runFromExport(fromExport);
|
|
263
|
+
}
|
|
264
|
+
else {
|
|
265
|
+
switch (provider) {
|
|
266
|
+
case 'sqlite':
|
|
267
|
+
await runSqlite();
|
|
268
|
+
break;
|
|
269
|
+
case 'mongodb':
|
|
270
|
+
await runMongodb();
|
|
271
|
+
break;
|
|
272
|
+
default:
|
|
273
|
+
console.log(' Storage: memory (in-memory) — nothing persisted. Use --from-export=<json> to analyse a dump.');
|
|
274
|
+
break;
|
|
275
|
+
}
|
|
276
|
+
}
|
|
277
|
+
console.log('');
|
|
278
|
+
//# sourceMappingURL=archive-stale-versions.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"archive-stale-versions.js","sourceRoot":"","sources":["../../scripts/archive-stale-versions.ts"],"names":[],"mappings":";AACA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA6BG;AAEH,OAAO,EAAE,UAAU,EAAE,YAAY,EAAE,QAAQ,EAAE,MAAM,SAAS,CAAC;AAC7D,OAAO,EAAE,OAAO,EAAE,OAAO,EAAE,MAAM,WAAW,CAAC;AAC7C,OAAO,EAAE,aAAa,EAAE,MAAM,UAAU,CAAC;AACzC,OAAO,EAAE,eAAe,EAAE,MAAM,eAAe,CAAC;AAEhD,MAAM,SAAS,GAAG,OAAO,CAAC,aAAa,CAAC,MAAM,CAAC,IAAI,CAAC,GAAG,CAAC,CAAC,CAAC;AAC1D,MAAM,IAA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a,EAAE,EAAE,SAAS,EAAE,CAAC,CAAC,SAAU,EAAE,GAAG,EAAE,CAAC,CAAC,GAAG,EAAE,EAAE,EAAE,IAAI,EAAE,EAAE,QAAQ,EAAE,IAAI,EAAE,UAAU,EAAE,EAAE,EAAE,UAAU,EAAE,WAAW,EAAE,YAAY,EAAE,YAAY,EAAE,EAAE,CAAC,CAAC;YACjM,IAAI,EAAE,CAAC;QACT,CAAC;QACD,OAAO,CAAC,GAAG,CAAC,cAAc,IAAI,CAAC,cAAc,EAAE,+BAA+B,YAAY,+DAA+D,CAAC,CAAC;IAC7J,CAAC;YAAS,CAAC;QACT,MAAM,MAAM,CAAC,WAAW,EAAE,CAAC;IAC7B,CAAC;AACH,CAAC;AAED,gEAAgE;AAChE,OAAO,CAAC,GAAG,CAAC,EAAE,CAAC,CAAC;AAChB,OAAO,CAAC,GAAG,CAAC,6CAA6C,CAAC,CAAC;AAC3D,OAAO,CAAC,GAAG,CAAC,8CAA8C,CAAC,CAAC;AAE5D,IAAI,UAAU,EAAE,CAAC;IACf,aAAa,CAAC,UAAU,CAAC,CAAC;AAC5B,CAAC;KAAM,CAAC;IACN,QAAQ,QAAQ,EAAE,CAAC;QACjB,KAAK,QAAQ;YAAE,MAAM,SAAS,EAAE,CAAC;YAAC,MAAM;QACxC,KAAK,SAAS;YAAE,MAAM,UAAU,EAAE,CAAC;YAAC,MAAM;QAC1C;YAAS,OAAO,CAAC,GAAG,CAAC,gGAAgG,CAAC,CAAC;YAAC,MAAM;IAChI,CAAC;AACH,CAAC;AACD,OAAO,CAAC,GAAG,CAAC,EAAE,CAAC,CAAC"}
|
|
@@ -5,13 +5,16 @@
|
|
|
5
5
|
* - PATCH /tags is same-owner gated -- an agent may set tags on itself or a
|
|
6
6
|
* same-owner sibling (parity with agent-caps self-report). The crew scaffold
|
|
7
7
|
* self-tags on every start via this path.
|
|
8
|
-
* - PATCH /mode
|
|
8
|
+
* - PATCH /mode is same-owner gated too (since v1.3.0) -- an agent may set its own /
|
|
9
|
+
* a same-owner sibling's mode, so a device-authed crew self-sets task-runner at startup.
|
|
9
10
|
*
|
|
10
11
|
* @version-history
|
|
11
12
|
* v1.0.0 -- 2026-05-29 -- Initial creation: tags_set + mode_set
|
|
12
13
|
* v1.1.0 -- 2026-05-30 -- MCP audit Phase 1: tool descriptions sourced from canonical catalog via descriptionFor().
|
|
13
14
|
* v1.2.0 -- 2026-06-24 -- tags_set is now agent-callable on its own/same-owner record
|
|
14
15
|
* (REST PATCH /tags relaxed from owner-role to same-owner). mode_set stays owner-only.
|
|
16
|
+
* v1.3.0 -- 2026-07-02 -- mode_set relaxed from owner-role to same-owner too (parity with tags_set),
|
|
17
|
+
* so a device-authed crew can self-set task-runner mode at startup.
|
|
15
18
|
*/
|
|
16
19
|
import { McpServer } from '@modelcontextprotocol/sdk/server/mcp.js';
|
|
17
20
|
import type { AgentRegistry } from '../../agent-registry.js';
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"agent-management.d.ts","sourceRoot":"","sources":["../../../../../../src/cli/connect/mcp/tools/agent-management.ts"],"names":[],"mappings":"AAAA
|
|
1
|
+
{"version":3,"file":"agent-management.d.ts","sourceRoot":"","sources":["../../../../../../src/cli/connect/mcp/tools/agent-management.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;GAiBG;AACH,OAAO,EAAE,SAAS,EAAE,MAAM,yCAAyC,CAAC;AAEpE,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,yBAAyB,CAAC;AAI7D,wBAAgB,4BAA4B,CAAC,GAAG,EAAE,SAAS,EAAE,QAAQ,EAAE,aAAa,GAAG,IAAI,CA+B1F"}
|
|
@@ -13,7 +13,7 @@ export function registerAgentManagementTools(mcp, registry) {
|
|
|
13
13
|
});
|
|
14
14
|
mcp.tool('aimeat_agent_mode_set', descriptionFor('aimeat_agent_mode_set'), {
|
|
15
15
|
agent_name: agentNameSchema,
|
|
16
|
-
target_agent_name: z.string().describe('Agent whose mode to update (
|
|
16
|
+
target_agent_name: z.string().describe('Agent whose mode to update (same owner as the calling agent; pass the caller\'s own name to self-set).'),
|
|
17
17
|
mode: z.enum(['autonomous', 'interactive', 'task-runner', 'coordinator', 'workstation']).describe('New mode.'),
|
|
18
18
|
}, async ({ agent_name, target_agent_name, mode }) => {
|
|
19
19
|
const { client } = pickAgent(registry, agent_name);
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"agent-management.js","sourceRoot":"","sources":["../../../../../../src/cli/connect/mcp/tools/agent-management.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"agent-management.js","sourceRoot":"","sources":["../../../../../../src/cli/connect/mcp/tools/agent-management.ts"],"names":[],"mappings":"AAmBA,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AAExB,OAAO,EAAE,eAAe,EAAE,SAAS,EAAE,MAAM,gBAAgB,CAAC;AAC5D,OAAO,EAAE,cAAc,EAAE,MAAM,kCAAkC,CAAC;AAElE,MAAM,UAAU,4BAA4B,CAAC,GAAc,EAAE,QAAuB;IAElF,GAAG,CAAC,IAAI,CACN,uBAAuB,EACvB,cAAc,CAAC,uBAAuB,CAAC,EACvC;QACE,UAAU,EAAE,eAAe;QAC3B,iBAAiB,EAAE,CAAC,CAAC,MAAM,EAAE,CAAC,QAAQ,CAAC,wGAAwG,CAAC;QAChJ,IAAI,EAAE,CAAC,CAAC,KAAK,CAAC,CAAC,CAAC,MAAM,EAAE,CAAC,CAAC,QAAQ,CAAC,oDAAoD,CAAC;KACzF,EACD,KAAK,EAAE,EAAE,UAAU,EAAE,iBAAiB,EAAE,IAAI,EAAE,EAAE,EAAE;QAChD,MAAM,EAAE,MAAM,EAAE,GAAG,SAAS,CAAC,QAAQ,EAAE,UAAU,CAAC,CAAC;QACnD,MAAM,IAAI,GAAG,MAAM,MAAM,CAAC,KAAK,CAAC,cAAc,kBAAkB,CAAC,iBAAiB,CAAC,OAAO,EAAE,EAAE,IAAI,EAAE,CAAC,CAAC;QACtG,OAAO,EAAE,OAAO,EAAE,CAAC,EAAE,IAAI,EAAE,MAAe,EAAE,IAAI,EAAE,IAAI,CAAC,SAAS,CAAC,IAAI,CAAC,IAAI,IAAI,IAAI,EAAE,IAAI,EAAE,CAAC,CAAC,EAAE,CAAC,EAAE,CAAC;IACpG,CAAC,CACF,CAAC;IAEF,GAAG,CAAC,IAAI,CACN,uBAAuB,EACvB,cAAc,CAAC,uBAAuB,CAAC,EACvC;QACE,UAAU,EAAE,eAAe;QAC3B,iBAAiB,EAAE,CAAC,CAAC,MAAM,EAAE,CAAC,QAAQ,CAAC,wGAAwG,CAAC;QAChJ,IAAI,EAAE,CAAC,CAAC,IAAI,CAAC,CAAC,YAAY,EAAE,aAAa,EAAE,aAAa,EAAE,aAAa,EAAE,aAAa,CAAC,CAAC,CAAC,QAAQ,CAAC,WAAW,CAAC;KAC/G,EACD,KAAK,EAAE,EAAE,UAAU,EAAE,iBAAiB,EAAE,IAAI,EAAE,EAAE,EAAE;QAChD,MAAM,EAAE,MAAM,EAAE,GAAG,SAAS,CAAC,QAAQ,EAAE,UAAU,CAAC,CAAC;QACnD,MAAM,IAAI,GAAG,MAAM,MAAM,CAAC,KAAK,CAAC,cAAc,kBAAkB,CAAC,iBAAiB,CAAC,OAAO,EAAE,EAAE,IAAI,EAAE,CAAC,CAAC;QACtG,OAAO,EAAE,OAAO,EAAE,CAAC,EAAE,IAAI,EAAE,MAAe,EAAE,IAAI,EAAE,IAAI,CAAC,SAAS,CAAC,IAAI,CAAC,IAAI,IAAI,IAAI,EAAE,IAAI,EAAE,CAAC,CAAC,EAAE,CAAC,EAAE,CAAC;IACpG,CAAC,CACF,CAAC;AACJ,CAAC"}
|
package/dist/src/config.d.ts
CHANGED
|
@@ -262,6 +262,16 @@ export interface AimeatConfig {
|
|
|
262
262
|
googleOAuthClientId: string;
|
|
263
263
|
googleOAuthClientSecret: string;
|
|
264
264
|
googleOAuthRedirectUri: string;
|
|
265
|
+
casdoorOAuthEnabled: boolean;
|
|
266
|
+
casdoorOAuthEndpoint: string;
|
|
267
|
+
casdoorOAuthClientId: string;
|
|
268
|
+
casdoorOAuthClientSecret: string;
|
|
269
|
+
casdoorOAuthRedirectUri: string;
|
|
270
|
+
entraOAuthEnabled: boolean;
|
|
271
|
+
entraOAuthTenant: string;
|
|
272
|
+
entraOAuthClientId: string;
|
|
273
|
+
entraOAuthClientSecret: string;
|
|
274
|
+
entraOAuthRedirectUri: string;
|
|
265
275
|
crossFederationEnabled: boolean;
|
|
266
276
|
maxGenesisPeers: number;
|
|
267
277
|
genesisSyncIntervalHours: number;
|
|
@@ -319,6 +329,7 @@ export interface AimeatConfig {
|
|
|
319
329
|
extensionMaxInstalled: number;
|
|
320
330
|
maxExtensionsPerOwner: number;
|
|
321
331
|
generatorEnabled: boolean;
|
|
332
|
+
secretaryEnabled: boolean;
|
|
322
333
|
foundryEnabled: boolean;
|
|
323
334
|
calibratorEnabled: boolean;
|
|
324
335
|
cortexEnabled: boolean;
|