aimeat 1.23.2 → 1.23.3
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/locales/en.json +536 -21
- package/dist/locales/fi.json +548 -33
- package/dist/public/components/ContactCard.js +28 -0
- package/dist/public/css/views/admin.css +12 -0
- package/dist/public/css/views/agents-detail.css +62 -10
- package/dist/public/css/views/landing.css +87 -0
- package/dist/public/css/views/offers.css +96 -0
- package/dist/public/css/views/portfolio.css +18 -0
- package/dist/public/css/views/profile.css +153 -8
- package/dist/public/css/views/start.css +96 -0
- package/dist/public/img/business-hero.png +0 -0
- package/dist/public/img/toimitus.png +0 -0
- package/dist/public/js/components/tag-cloud.js +46 -31
- package/dist/public/js/components/tag-editor.js +2 -2
- package/dist/public/js/recents.js +40 -0
- package/dist/public/js/services/admin.js +6 -0
- package/dist/public/js/services/agents.js +34 -0
- package/dist/public/js/services/offers.js +152 -0
- package/dist/public/js/services/packages.js +1 -0
- package/dist/public/spa.html +32 -2
- package/dist/public/views/admin/subdomains-tab.js +182 -0
- package/dist/public/views/admin.js +2 -0
- package/dist/public/views/business.js +119 -0
- package/dist/public/views/how-it-works.js +159 -0
- package/dist/public/views/landing.js +235 -0
- package/dist/public/views/portfolio.js +120 -23
- package/dist/public/views/pricing.js +75 -0
- package/dist/public/views/profile/access-tab.js +124 -51
- package/dist/public/views/profile/agents/agent-card.js +68 -37
- package/dist/public/views/profile/agents/shared-board.js +56 -22
- package/dist/public/views/profile/agents/tab-activity.js +24 -12
- package/dist/public/views/profile/agents/tab-agent-config.js +31 -1
- package/dist/public/views/profile/agents/tab-data-access.js +9 -13
- package/dist/public/views/profile/agents/tab-integration.js +27 -1
- package/dist/public/views/profile/agents/tab-messages.js +6 -11
- package/dist/public/views/profile/agents/tab-quality.js +45 -5
- package/dist/public/views/profile/agents-tab.js +41 -6
- package/dist/public/views/profile/apps-tab.js +7 -1
- package/dist/public/views/profile/knowledge-tab.js +4 -1
- package/dist/public/views/profile/landing-page.js +427 -123
- package/dist/public/views/profile/memory-tab.js +409 -211
- package/dist/public/views/profile/nodes-tab.js +18 -3
- package/dist/public/views/profile/offers-tab.js +310 -0
- package/dist/public/views/profile/organisms-tab.js +289 -28
- package/dist/public/views/profile/packages-tab.js +152 -16
- package/dist/public/views/profile/portfolio-tab.js +98 -31
- package/dist/public/views/profile.js +2 -0
- package/dist/public/views/start-flows.js +281 -0
- package/dist/public/views/start.js +258 -0
- package/dist/src/generated/api-types.d.ts +856 -17
- package/dist/src/generated/api-types.d.ts.map +1 -1
- package/dist/src/generated/prisma-postgres/edge.js +15 -3
- package/dist/src/generated/prisma-postgres/index-browser.js +12 -0
- package/dist/src/generated/prisma-postgres/index.d.ts +1476 -160
- package/dist/src/generated/prisma-postgres/index.js +15 -3
- package/dist/src/generated/prisma-postgres/package.json +1 -1
- package/dist/src/generated/prisma-postgres/schema.prisma +11 -0
- package/dist/src/generated/prisma-postgres/wasm.js +15 -3
- package/dist/src/middleware/subdomain.d.ts +28 -0
- package/dist/src/middleware/subdomain.d.ts.map +1 -0
- package/dist/src/middleware/subdomain.js +32 -0
- package/dist/src/middleware/subdomain.js.map +1 -0
- package/dist/src/models/offer-schemas.d.ts +229 -0
- package/dist/src/models/offer-schemas.d.ts.map +1 -0
- package/dist/src/models/offer-schemas.js +100 -0
- package/dist/src/models/offer-schemas.js.map +1 -0
- package/dist/src/routes/agent-tasks.d.ts.map +1 -1
- package/dist/src/routes/agent-tasks.js +33 -0
- 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 +146 -1
- package/dist/src/routes/agents.js.map +1 -1
- package/dist/src/routes/apps-backup.d.ts +20 -0
- package/dist/src/routes/apps-backup.d.ts.map +1 -0
- package/dist/src/routes/apps-backup.js +165 -0
- package/dist/src/routes/apps-backup.js.map +1 -0
- package/dist/src/routes/ghii.d.ts.map +1 -1
- package/dist/src/routes/ghii.js +4 -0
- package/dist/src/routes/ghii.js.map +1 -1
- package/dist/src/routes/instances.d.ts +2 -1
- package/dist/src/routes/instances.d.ts.map +1 -1
- package/dist/src/routes/instances.js +59 -1
- package/dist/src/routes/instances.js.map +1 -1
- package/dist/src/routes/packages.d.ts.map +1 -1
- package/dist/src/routes/packages.js +32 -0
- package/dist/src/routes/packages.js.map +1 -1
- package/dist/src/routes/permissions.d.ts +12 -0
- package/dist/src/routes/permissions.d.ts.map +1 -1
- package/dist/src/routes/permissions.js +35 -3
- package/dist/src/routes/permissions.js.map +1 -1
- package/dist/src/routes/portal.d.ts +3 -0
- package/dist/src/routes/portal.d.ts.map +1 -1
- package/dist/src/routes/portal.js +12 -0
- package/dist/src/routes/portal.js.map +1 -1
- package/dist/src/routes/public-stats.d.ts +15 -0
- package/dist/src/routes/public-stats.d.ts.map +1 -0
- package/dist/src/routes/public-stats.js +90 -0
- package/dist/src/routes/public-stats.js.map +1 -0
- package/dist/src/routes/sse.d.ts +7 -2
- package/dist/src/routes/sse.d.ts.map +1 -1
- package/dist/src/routes/sse.js +35 -5
- package/dist/src/routes/sse.js.map +1 -1
- package/dist/src/routes/subdomains.d.ts +33 -0
- package/dist/src/routes/subdomains.d.ts.map +1 -0
- package/dist/src/routes/subdomains.js +208 -0
- package/dist/src/routes/subdomains.js.map +1 -0
- package/dist/src/server-bootstrap/routes-loader.d.ts.map +1 -1
- package/dist/src/server-bootstrap/routes-loader.js +12 -1
- package/dist/src/server-bootstrap/routes-loader.js.map +1 -1
- package/dist/src/server.d.ts.map +1 -1
- package/dist/src/server.js +4 -0
- package/dist/src/server.js.map +1 -1
- package/dist/src/services/apps-backup-export.d.ts +22 -0
- package/dist/src/services/apps-backup-export.d.ts.map +1 -0
- package/dist/src/services/apps-backup-export.js +136 -0
- package/dist/src/services/apps-backup-export.js.map +1 -0
- package/dist/src/services/apps-backup-import.d.ts +120 -0
- package/dist/src/services/apps-backup-import.d.ts.map +1 -0
- package/dist/src/services/apps-backup-import.js +259 -0
- package/dist/src/services/apps-backup-import.js.map +1 -0
- package/dist/src/services/component-registrar.d.ts +17 -0
- package/dist/src/services/component-registrar.d.ts.map +1 -1
- package/dist/src/services/component-registrar.js +63 -5
- package/dist/src/services/component-registrar.js.map +1 -1
- package/dist/src/services/handbooks/appdev.d.ts +1 -1
- package/dist/src/services/handbooks/appdev.d.ts.map +1 -1
- package/dist/src/services/handbooks/appdev.js +5 -2
- package/dist/src/services/handbooks/appdev.js.map +1 -1
- package/dist/src/storage/interface.d.ts +11 -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 +10 -1
- package/dist/src/storage/providers/mongodb/index.d.ts.map +1 -1
- package/dist/src/storage/providers/mongodb/index.js +76 -0
- package/dist/src/storage/providers/mongodb/index.js.map +1 -1
- package/dist/src/storage/providers/sqlite/index.d.ts +8 -1
- package/dist/src/storage/providers/sqlite/index.d.ts.map +1 -1
- package/dist/src/storage/providers/sqlite/index.js +61 -0
- 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 +11 -0
- package/dist/src/storage/providers/sqlite/schema.js.map +1 -1
- package/dist/src/storage/repositories/index.d.ts +1 -0
- package/dist/src/storage/repositories/index.d.ts.map +1 -1
- package/dist/src/storage/repositories/package.repository.d.ts +2 -0
- package/dist/src/storage/repositories/package.repository.d.ts.map +1 -1
- package/dist/src/storage/repositories/subdomain-site.repository.d.ts +19 -0
- package/dist/src/storage/repositories/subdomain-site.repository.d.ts.map +1 -0
- package/dist/src/storage/repositories/subdomain-site.repository.js +2 -0
- package/dist/src/storage/repositories/subdomain-site.repository.js.map +1 -0
- package/dist/static/app-catalog.html +1139 -28
- package/package.json +1 -1
- package/prisma/schema.postgres.prisma +11 -0
- package/prisma/schema.prisma +11 -0
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @file subdomain.ts
|
|
3
|
+
* @description Resolves the request's subdomain label into `req.subdomain`.
|
|
4
|
+
* In production nginx proxies all `<sub>.<apex>` requests to this
|
|
5
|
+
* backend with an `X-Subdomain: <sub>` header (apex requests carry
|
|
6
|
+
* no such header). A hostname fallback covers dev setups where the
|
|
7
|
+
* header is absent but the Host matches `<sub>.<apex-host>`.
|
|
8
|
+
* @structure subdomainMiddleware(config) — Express middleware factory.
|
|
9
|
+
* @usage app.use(subdomainMiddleware(config)); // before route mounting
|
|
10
|
+
* @version-history
|
|
11
|
+
* v1.0.0 — 2026-06-12 — Initial: subdomain routing (operator-only management)
|
|
12
|
+
*/
|
|
13
|
+
import type { Request, Response, NextFunction } from 'express';
|
|
14
|
+
import type { AimeatConfig } from '../config.js';
|
|
15
|
+
declare global {
|
|
16
|
+
namespace Express {
|
|
17
|
+
interface Request {
|
|
18
|
+
subdomain?: string | null;
|
|
19
|
+
}
|
|
20
|
+
}
|
|
21
|
+
}
|
|
22
|
+
/**
|
|
23
|
+
* Sets `req.subdomain` to the lowercase leftmost label of the requested
|
|
24
|
+
* subdomain, or null for apex requests. Header wins; hostname is a fallback
|
|
25
|
+
* matched against the apex host derived from config.baseUrl.
|
|
26
|
+
*/
|
|
27
|
+
export declare function subdomainMiddleware(config: AimeatConfig): (req: Request, _res: Response, next: NextFunction) => void;
|
|
28
|
+
//# sourceMappingURL=subdomain.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"subdomain.d.ts","sourceRoot":"","sources":["../../../src/middleware/subdomain.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;GAWG;AACH,OAAO,KAAK,EAAE,OAAO,EAAE,QAAQ,EAAE,YAAY,EAAE,MAAM,SAAS,CAAC;AAC/D,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,cAAc,CAAC;AAEjD,OAAO,CAAC,MAAM,CAAC;IAEb,UAAU,OAAO,CAAC;QAChB,UAAU,OAAO;YACf,SAAS,CAAC,EAAE,MAAM,GAAG,IAAI,CAAC;SAC3B;KACF;CACF;AAED;;;;GAIG;AACH,wBAAgB,mBAAmB,CAAC,MAAM,EAAE,YAAY,IAO9C,KAAK,OAAO,EAAE,MAAM,QAAQ,EAAE,MAAM,YAAY,UAiBzD"}
|
|
@@ -0,0 +1,32 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Sets `req.subdomain` to the lowercase leftmost label of the requested
|
|
3
|
+
* subdomain, or null for apex requests. Header wins; hostname is a fallback
|
|
4
|
+
* matched against the apex host derived from config.baseUrl.
|
|
5
|
+
*/
|
|
6
|
+
export function subdomainMiddleware(config) {
|
|
7
|
+
// "https://aimeat.io" → "aimeat.io" (empty for unparseable baseUrls)
|
|
8
|
+
let apexHost = '';
|
|
9
|
+
try {
|
|
10
|
+
apexHost = new URL(config.baseUrl).hostname.toLowerCase();
|
|
11
|
+
}
|
|
12
|
+
catch { /* no hostname fallback without a valid baseUrl */ }
|
|
13
|
+
return (req, _res, next) => {
|
|
14
|
+
const fromHeader = req.get('x-subdomain');
|
|
15
|
+
if (fromHeader) {
|
|
16
|
+
req.subdomain = fromHeader.trim().toLowerCase();
|
|
17
|
+
return next();
|
|
18
|
+
}
|
|
19
|
+
req.subdomain = null;
|
|
20
|
+
if (apexHost) {
|
|
21
|
+
const host = (req.hostname || '').toLowerCase();
|
|
22
|
+
if (host !== apexHost && host.endsWith('.' + apexHost)) {
|
|
23
|
+
const label = host.slice(0, -(apexHost.length + 1));
|
|
24
|
+
// Single-level subdomains only — nginx's server_name regex matches one label
|
|
25
|
+
if (label && !label.includes('.'))
|
|
26
|
+
req.subdomain = label;
|
|
27
|
+
}
|
|
28
|
+
}
|
|
29
|
+
next();
|
|
30
|
+
};
|
|
31
|
+
}
|
|
32
|
+
//# sourceMappingURL=subdomain.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"subdomain.js","sourceRoot":"","sources":["../../../src/middleware/subdomain.ts"],"names":[],"mappings":"AAwBA;;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od validation for an agent's published "offers" — the human-readable face of the
|
|
4
|
+
* agent's machine contract ("here's what I can do for you, with an example, the outcome, and a
|
|
5
|
+
* sample deliverable"). An agent publishes `agents.{name}.offers`; the profile Offers surface renders
|
|
6
|
+
* it (goal-first search → Ask), and the mesh consumes the same record for delegate selection. This is
|
|
7
|
+
* the single shared contract — keep it in sync with docs/plans/2026-06-12-agent-offers-surface.md §4.
|
|
8
|
+
* @structure
|
|
9
|
+
* - OfferSchema — one offer (ask/example/cost/latency/verification/dataHandling/requirements/
|
|
10
|
+
* consequences/availability/deliverable)
|
|
11
|
+
* - OffersDocSchema — the published document { version, updatedAt, offers: Offer[] }
|
|
12
|
+
* @usage import { OffersDocSchema } from '../models/offer-schemas.js';
|
|
13
|
+
* const parsed = OffersDocSchema.safeParse(req.body);
|
|
14
|
+
* @version-history
|
|
15
|
+
* v1.0.0 -- 2026-06-12 -- Initial: offer descriptor (Agent Offers surface v1).
|
|
16
|
+
* v2.0.0 -- 2026-06-12 -- Billable offers: price + visibility + callable binding. An offer is a
|
|
17
|
+
* billable capability — free for the owner's own use, debited (morsels owner→provider) when a
|
|
18
|
+
* different owner invokes it. `visibility:'public'` lists it in the catalogue; `callable` binds it
|
|
19
|
+
* to a machine-invocable action/webhook. All v2 fields optional → v1 docs validate unchanged.
|
|
20
|
+
* See docs/plans/2026-06-12-services-to-offers-migration.md.
|
|
21
|
+
*/
|
|
22
|
+
import { z } from 'zod';
|
|
23
|
+
export declare const OfferSchema: z.ZodObject<{
|
|
24
|
+
id: z.ZodString;
|
|
25
|
+
title: z.ZodString;
|
|
26
|
+
ask: z.ZodString;
|
|
27
|
+
example: z.ZodOptional<z.ZodString>;
|
|
28
|
+
tags: z.ZodOptional<z.ZodArray<z.ZodString>>;
|
|
29
|
+
cost: z.ZodOptional<z.ZodEnum<{
|
|
30
|
+
free: "free";
|
|
31
|
+
cheap: "cheap";
|
|
32
|
+
expensive: "expensive";
|
|
33
|
+
}>>;
|
|
34
|
+
latency: z.ZodOptional<z.ZodEnum<{
|
|
35
|
+
seconds: "seconds";
|
|
36
|
+
minutes: "minutes";
|
|
37
|
+
"long-running": "long-running";
|
|
38
|
+
}>>;
|
|
39
|
+
repeatability: z.ZodOptional<z.ZodEnum<{
|
|
40
|
+
idempotent: "idempotent";
|
|
41
|
+
accumulative: "accumulative";
|
|
42
|
+
destructive: "destructive";
|
|
43
|
+
}>>;
|
|
44
|
+
verification: z.ZodOptional<z.ZodEnum<{
|
|
45
|
+
deterministic: "deterministic";
|
|
46
|
+
gated: "gated";
|
|
47
|
+
ungated: "ungated";
|
|
48
|
+
}>>;
|
|
49
|
+
dataHandling: z.ZodOptional<z.ZodEnum<{
|
|
50
|
+
"local-only": "local-only";
|
|
51
|
+
"llm-provider": "llm-provider";
|
|
52
|
+
"third-party": "third-party";
|
|
53
|
+
}>>;
|
|
54
|
+
availability: z.ZodOptional<z.ZodObject<{
|
|
55
|
+
boundToLastSeen: z.ZodOptional<z.ZodBoolean>;
|
|
56
|
+
scheduleBorn: z.ZodOptional<z.ZodNullable<z.ZodUnion<readonly [z.ZodString, z.ZodObject<{
|
|
57
|
+
scheduleId: z.ZodString;
|
|
58
|
+
human: z.ZodOptional<z.ZodString>;
|
|
59
|
+
}, z.core.$strip>]>>>;
|
|
60
|
+
}, z.core.$strip>>;
|
|
61
|
+
requirements: z.ZodOptional<z.ZodArray<z.ZodObject<{
|
|
62
|
+
need: z.ZodString;
|
|
63
|
+
fix: z.ZodOptional<z.ZodString>;
|
|
64
|
+
instruction: z.ZodOptional<z.ZodString>;
|
|
65
|
+
}, z.core.$strip>>>;
|
|
66
|
+
inputs: z.ZodOptional<z.ZodArray<z.ZodObject<{
|
|
67
|
+
name: z.ZodString;
|
|
68
|
+
required: z.ZodOptional<z.ZodBoolean>;
|
|
69
|
+
}, z.core.$strip>>>;
|
|
70
|
+
consequences: z.ZodOptional<z.ZodArray<z.ZodObject<{
|
|
71
|
+
type: z.ZodEnum<{
|
|
72
|
+
"creates-agent": "creates-agent";
|
|
73
|
+
"creates-schedule": "creates-schedule";
|
|
74
|
+
"mutates-host": "mutates-host";
|
|
75
|
+
"publishes-public": "publishes-public";
|
|
76
|
+
"external-send": "external-send";
|
|
77
|
+
"mutates-live-app": "mutates-live-app";
|
|
78
|
+
"delegates-to-agent": "delegates-to-agent";
|
|
79
|
+
}>;
|
|
80
|
+
persistent: z.ZodOptional<z.ZodBoolean>;
|
|
81
|
+
requiresApproval: z.ZodOptional<z.ZodBoolean>;
|
|
82
|
+
dynamic: z.ZodOptional<z.ZodBoolean>;
|
|
83
|
+
ratesThirdParties: z.ZodOptional<z.ZodBoolean>;
|
|
84
|
+
allowlist: z.ZodOptional<z.ZodArray<z.ZodString>>;
|
|
85
|
+
note: z.ZodOptional<z.ZodString>;
|
|
86
|
+
}, z.core.$strip>>>;
|
|
87
|
+
deliverable: z.ZodObject<{
|
|
88
|
+
format: z.ZodEnum<{
|
|
89
|
+
file: "file";
|
|
90
|
+
app: "app";
|
|
91
|
+
document: "document";
|
|
92
|
+
record: "record";
|
|
93
|
+
"board-post": "board-post";
|
|
94
|
+
}>;
|
|
95
|
+
location: z.ZodOptional<z.ZodObject<{
|
|
96
|
+
space: z.ZodOptional<z.ZodString>;
|
|
97
|
+
key: z.ZodOptional<z.ZodString>;
|
|
98
|
+
url: z.ZodOptional<z.ZodString>;
|
|
99
|
+
visibility: z.ZodOptional<z.ZodString>;
|
|
100
|
+
}, z.core.$strip>>;
|
|
101
|
+
sample: z.ZodOptional<z.ZodUnion<readonly [z.ZodString, z.ZodRecord<z.ZodString, z.ZodUnknown>, z.ZodLiteral<"untested">]>>;
|
|
102
|
+
}, z.core.$strip>;
|
|
103
|
+
price: z.ZodOptional<z.ZodNullable<z.ZodObject<{
|
|
104
|
+
morsels: z.ZodNumber;
|
|
105
|
+
unit: z.ZodOptional<z.ZodEnum<{
|
|
106
|
+
"per-call": "per-call";
|
|
107
|
+
"per-result": "per-result";
|
|
108
|
+
subscription: "subscription";
|
|
109
|
+
}>>;
|
|
110
|
+
}, z.core.$strip>>>;
|
|
111
|
+
visibility: z.ZodOptional<z.ZodEnum<{
|
|
112
|
+
public: "public";
|
|
113
|
+
private: "private";
|
|
114
|
+
unlisted: "unlisted";
|
|
115
|
+
}>>;
|
|
116
|
+
callable: z.ZodOptional<z.ZodNullable<z.ZodObject<{
|
|
117
|
+
action_id: z.ZodOptional<z.ZodString>;
|
|
118
|
+
webhook_url: z.ZodOptional<z.ZodString>;
|
|
119
|
+
input_schema: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodUnknown>>;
|
|
120
|
+
output_schema: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodUnknown>>;
|
|
121
|
+
}, z.core.$strip>>>;
|
|
122
|
+
}, z.core.$strip>;
|
|
123
|
+
export declare const OffersDocSchema: z.ZodObject<{
|
|
124
|
+
version: z.ZodOptional<z.ZodNumber>;
|
|
125
|
+
updatedAt: z.ZodOptional<z.ZodString>;
|
|
126
|
+
offers: z.ZodArray<z.ZodObject<{
|
|
127
|
+
id: z.ZodString;
|
|
128
|
+
title: z.ZodString;
|
|
129
|
+
ask: z.ZodString;
|
|
130
|
+
example: z.ZodOptional<z.ZodString>;
|
|
131
|
+
tags: z.ZodOptional<z.ZodArray<z.ZodString>>;
|
|
132
|
+
cost: z.ZodOptional<z.ZodEnum<{
|
|
133
|
+
free: "free";
|
|
134
|
+
cheap: "cheap";
|
|
135
|
+
expensive: "expensive";
|
|
136
|
+
}>>;
|
|
137
|
+
latency: z.ZodOptional<z.ZodEnum<{
|
|
138
|
+
seconds: "seconds";
|
|
139
|
+
minutes: "minutes";
|
|
140
|
+
"long-running": "long-running";
|
|
141
|
+
}>>;
|
|
142
|
+
repeatability: z.ZodOptional<z.ZodEnum<{
|
|
143
|
+
idempotent: "idempotent";
|
|
144
|
+
accumulative: "accumulative";
|
|
145
|
+
destructive: "destructive";
|
|
146
|
+
}>>;
|
|
147
|
+
verification: z.ZodOptional<z.ZodEnum<{
|
|
148
|
+
deterministic: "deterministic";
|
|
149
|
+
gated: "gated";
|
|
150
|
+
ungated: "ungated";
|
|
151
|
+
}>>;
|
|
152
|
+
dataHandling: z.ZodOptional<z.ZodEnum<{
|
|
153
|
+
"local-only": "local-only";
|
|
154
|
+
"llm-provider": "llm-provider";
|
|
155
|
+
"third-party": "third-party";
|
|
156
|
+
}>>;
|
|
157
|
+
availability: z.ZodOptional<z.ZodObject<{
|
|
158
|
+
boundToLastSeen: z.ZodOptional<z.ZodBoolean>;
|
|
159
|
+
scheduleBorn: z.ZodOptional<z.ZodNullable<z.ZodUnion<readonly [z.ZodString, z.ZodObject<{
|
|
160
|
+
scheduleId: z.ZodString;
|
|
161
|
+
human: z.ZodOptional<z.ZodString>;
|
|
162
|
+
}, z.core.$strip>]>>>;
|
|
163
|
+
}, z.core.$strip>>;
|
|
164
|
+
requirements: z.ZodOptional<z.ZodArray<z.ZodObject<{
|
|
165
|
+
need: z.ZodString;
|
|
166
|
+
fix: z.ZodOptional<z.ZodString>;
|
|
167
|
+
instruction: z.ZodOptional<z.ZodString>;
|
|
168
|
+
}, z.core.$strip>>>;
|
|
169
|
+
inputs: z.ZodOptional<z.ZodArray<z.ZodObject<{
|
|
170
|
+
name: z.ZodString;
|
|
171
|
+
required: z.ZodOptional<z.ZodBoolean>;
|
|
172
|
+
}, z.core.$strip>>>;
|
|
173
|
+
consequences: z.ZodOptional<z.ZodArray<z.ZodObject<{
|
|
174
|
+
type: z.ZodEnum<{
|
|
175
|
+
"creates-agent": "creates-agent";
|
|
176
|
+
"creates-schedule": "creates-schedule";
|
|
177
|
+
"mutates-host": "mutates-host";
|
|
178
|
+
"publishes-public": "publishes-public";
|
|
179
|
+
"external-send": "external-send";
|
|
180
|
+
"mutates-live-app": "mutates-live-app";
|
|
181
|
+
"delegates-to-agent": "delegates-to-agent";
|
|
182
|
+
}>;
|
|
183
|
+
persistent: z.ZodOptional<z.ZodBoolean>;
|
|
184
|
+
requiresApproval: z.ZodOptional<z.ZodBoolean>;
|
|
185
|
+
dynamic: z.ZodOptional<z.ZodBoolean>;
|
|
186
|
+
ratesThirdParties: z.ZodOptional<z.ZodBoolean>;
|
|
187
|
+
allowlist: z.ZodOptional<z.ZodArray<z.ZodString>>;
|
|
188
|
+
note: z.ZodOptional<z.ZodString>;
|
|
189
|
+
}, z.core.$strip>>>;
|
|
190
|
+
deliverable: z.ZodObject<{
|
|
191
|
+
format: z.ZodEnum<{
|
|
192
|
+
file: "file";
|
|
193
|
+
app: "app";
|
|
194
|
+
document: "document";
|
|
195
|
+
record: "record";
|
|
196
|
+
"board-post": "board-post";
|
|
197
|
+
}>;
|
|
198
|
+
location: z.ZodOptional<z.ZodObject<{
|
|
199
|
+
space: z.ZodOptional<z.ZodString>;
|
|
200
|
+
key: z.ZodOptional<z.ZodString>;
|
|
201
|
+
url: z.ZodOptional<z.ZodString>;
|
|
202
|
+
visibility: z.ZodOptional<z.ZodString>;
|
|
203
|
+
}, z.core.$strip>>;
|
|
204
|
+
sample: z.ZodOptional<z.ZodUnion<readonly [z.ZodString, z.ZodRecord<z.ZodString, z.ZodUnknown>, z.ZodLiteral<"untested">]>>;
|
|
205
|
+
}, z.core.$strip>;
|
|
206
|
+
price: z.ZodOptional<z.ZodNullable<z.ZodObject<{
|
|
207
|
+
morsels: z.ZodNumber;
|
|
208
|
+
unit: z.ZodOptional<z.ZodEnum<{
|
|
209
|
+
"per-call": "per-call";
|
|
210
|
+
"per-result": "per-result";
|
|
211
|
+
subscription: "subscription";
|
|
212
|
+
}>>;
|
|
213
|
+
}, z.core.$strip>>>;
|
|
214
|
+
visibility: z.ZodOptional<z.ZodEnum<{
|
|
215
|
+
public: "public";
|
|
216
|
+
private: "private";
|
|
217
|
+
unlisted: "unlisted";
|
|
218
|
+
}>>;
|
|
219
|
+
callable: z.ZodOptional<z.ZodNullable<z.ZodObject<{
|
|
220
|
+
action_id: z.ZodOptional<z.ZodString>;
|
|
221
|
+
webhook_url: z.ZodOptional<z.ZodString>;
|
|
222
|
+
input_schema: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodUnknown>>;
|
|
223
|
+
output_schema: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodUnknown>>;
|
|
224
|
+
}, z.core.$strip>>>;
|
|
225
|
+
}, z.core.$strip>>;
|
|
226
|
+
}, z.core.$strip>;
|
|
227
|
+
export type Offer = z.infer<typeof OfferSchema>;
|
|
228
|
+
export type OffersDoc = z.infer<typeof OffersDocSchema>;
|
|
229
|
+
//# sourceMappingURL=offer-schemas.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"offer-schemas.d.ts","sourceRoot":"","sources":["../../../src/models/offer-schemas.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;GAoBG;AACH,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AA2DxB,eAAO,MAAM,WAAW;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;iBAoBtB,CAAC;AAEH,eAAO,MAAM,eAAe;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;iBAI1B,CAAC;AAEH,MAAM,MAAM,KAAK,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,WAAW,CAAC,CAAC;AAChD,MAAM,MAAM,SAAS,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,eAAe,CAAC,CAAC"}
|
|
@@ -0,0 +1,100 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @file offer-schemas.ts
|
|
3
|
+
* @description Zod validation for an agent's published "offers" — the human-readable face of the
|
|
4
|
+
* agent's machine contract ("here's what I can do for you, with an example, the outcome, and a
|
|
5
|
+
* sample deliverable"). An agent publishes `agents.{name}.offers`; the profile Offers surface renders
|
|
6
|
+
* it (goal-first search → Ask), and the mesh consumes the same record for delegate selection. This is
|
|
7
|
+
* the single shared contract — keep it in sync with docs/plans/2026-06-12-agent-offers-surface.md §4.
|
|
8
|
+
* @structure
|
|
9
|
+
* - OfferSchema — one offer (ask/example/cost/latency/verification/dataHandling/requirements/
|
|
10
|
+
* consequences/availability/deliverable)
|
|
11
|
+
* - OffersDocSchema — the published document { version, updatedAt, offers: Offer[] }
|
|
12
|
+
* @usage import { OffersDocSchema } from '../models/offer-schemas.js';
|
|
13
|
+
* const parsed = OffersDocSchema.safeParse(req.body);
|
|
14
|
+
* @version-history
|
|
15
|
+
* v1.0.0 -- 2026-06-12 -- Initial: offer descriptor (Agent Offers surface v1).
|
|
16
|
+
* v2.0.0 -- 2026-06-12 -- Billable offers: price + visibility + callable binding. An offer is a
|
|
17
|
+
* billable capability — free for the owner's own use, debited (morsels owner→provider) when a
|
|
18
|
+
* different owner invokes it. `visibility:'public'` lists it in the catalogue; `callable` binds it
|
|
19
|
+
* to a machine-invocable action/webhook. All v2 fields optional → v1 docs validate unchanged.
|
|
20
|
+
* See docs/plans/2026-06-12-services-to-offers-migration.md.
|
|
21
|
+
*/
|
|
22
|
+
import { z } from 'zod';
|
|
23
|
+
// ── v2: billable / listable / callable ──────────────────────────────────────
|
|
24
|
+
// Concrete morsel price for cross-owner invocation. `null`/absent = not for sale (self-use only).
|
|
25
|
+
// Distinct from the qualitative `cost` ('free'|'cheap'|'expensive') hint, which stays for goal-search.
|
|
26
|
+
const PriceSchema = z.object({
|
|
27
|
+
morsels: z.number().int().nonnegative(),
|
|
28
|
+
unit: z.enum(['per-call', 'per-result', 'subscription']).optional(), // default per-call at the billing site
|
|
29
|
+
}).nullable();
|
|
30
|
+
// Machine-invocable binding. Present ⇒ a non-owner can invoke and be billed; absent ⇒ human-prompt/task offer.
|
|
31
|
+
const CallableSchema = z.object({
|
|
32
|
+
action_id: z.string().max(200).optional(), // an existing capability/action id that backs this offer
|
|
33
|
+
webhook_url: z.string().max(500).optional(), // or a direct webhook
|
|
34
|
+
input_schema: z.record(z.string(), z.unknown()).optional(),
|
|
35
|
+
output_schema: z.record(z.string(), z.unknown()).optional(),
|
|
36
|
+
}).nullable();
|
|
37
|
+
const RequirementSchema = z.object({
|
|
38
|
+
need: z.string().min(1).max(200),
|
|
39
|
+
fix: z.string().max(64).optional(), // a one-click fix chip id (e.g. 'join', 'adopt-contract')
|
|
40
|
+
instruction: z.string().max(500).optional(), // guidance text when no one-click fix exists (machine-local preconditions)
|
|
41
|
+
});
|
|
42
|
+
const ConsequenceSchema = z.object({
|
|
43
|
+
// Only what SURVIVES the task — persistent / approval / external / host. In-process fan-out is not here.
|
|
44
|
+
type: z.enum([
|
|
45
|
+
'creates-agent', 'creates-schedule', 'mutates-host', 'publishes-public',
|
|
46
|
+
'external-send', 'mutates-live-app', 'delegates-to-agent',
|
|
47
|
+
]),
|
|
48
|
+
persistent: z.boolean().optional(),
|
|
49
|
+
requiresApproval: z.boolean().optional(),
|
|
50
|
+
dynamic: z.boolean().optional(), // the real chain renders live from task events, not the manifest
|
|
51
|
+
ratesThirdParties: z.boolean().optional(), // a coordinator may write ratings to the agents it delegates to
|
|
52
|
+
allowlist: z.array(z.string().max(200)).max(50).optional(), // for external-send
|
|
53
|
+
note: z.string().max(300).optional(),
|
|
54
|
+
});
|
|
55
|
+
const AvailabilitySchema = z.object({
|
|
56
|
+
boundToLastSeen: z.boolean().optional(),
|
|
57
|
+
// string (human label) OR { scheduleId, human } so Run can trigger the schedule.
|
|
58
|
+
scheduleBorn: z.union([
|
|
59
|
+
z.string().max(200),
|
|
60
|
+
z.object({ scheduleId: z.string().max(100), human: z.string().max(200).optional() }),
|
|
61
|
+
]).nullable().optional(),
|
|
62
|
+
}).optional();
|
|
63
|
+
const DeliverableSchema = z.object({
|
|
64
|
+
format: z.enum(['document', 'record', 'board-post', 'file', 'app']),
|
|
65
|
+
location: z.object({
|
|
66
|
+
space: z.string().max(200).optional(),
|
|
67
|
+
key: z.string().max(400).optional(),
|
|
68
|
+
url: z.string().max(500).optional(),
|
|
69
|
+
visibility: z.string().max(40).optional(),
|
|
70
|
+
}).optional(),
|
|
71
|
+
// A REAL excerpt from the last successful deliverable, or the literal "untested". Object | string.
|
|
72
|
+
sample: z.union([z.string().max(8000), z.record(z.string(), z.unknown()), z.literal('untested')]).optional(),
|
|
73
|
+
});
|
|
74
|
+
export const OfferSchema = z.object({
|
|
75
|
+
id: z.string().min(1).max(100),
|
|
76
|
+
title: z.string().min(1).max(120),
|
|
77
|
+
ask: z.string().min(1).max(500), // plain-language invite incl. negative scope
|
|
78
|
+
example: z.string().max(500).optional(),
|
|
79
|
+
tags: z.array(z.string().max(64)).max(20).optional(), // reuse existing machine tags for goal-search
|
|
80
|
+
cost: z.enum(['free', 'cheap', 'expensive']).optional(),
|
|
81
|
+
latency: z.enum(['seconds', 'minutes', 'long-running']).optional(),
|
|
82
|
+
repeatability: z.enum(['idempotent', 'accumulative', 'destructive']).optional(),
|
|
83
|
+
verification: z.enum(['deterministic', 'gated', 'ungated']).optional(), // deterministic = no LLM in I/O path (strongest)
|
|
84
|
+
dataHandling: z.enum(['local-only', 'llm-provider', 'third-party']).optional(), // where input data flows
|
|
85
|
+
availability: AvailabilitySchema,
|
|
86
|
+
requirements: z.array(RequirementSchema).max(20).optional(),
|
|
87
|
+
inputs: z.array(z.object({ name: z.string().max(80), required: z.boolean().optional() })).max(20).optional(),
|
|
88
|
+
consequences: z.array(ConsequenceSchema).max(20).optional(),
|
|
89
|
+
deliverable: DeliverableSchema,
|
|
90
|
+
// ── v2 billable/listable/callable (all optional; default to private, not-for-sale, human-driven) ──
|
|
91
|
+
price: PriceSchema.optional(),
|
|
92
|
+
visibility: z.enum(['private', 'unlisted', 'public']).optional(), // default 'private' at read/list time
|
|
93
|
+
callable: CallableSchema.optional(),
|
|
94
|
+
});
|
|
95
|
+
export const OffersDocSchema = z.object({
|
|
96
|
+
version: z.number().int().nonnegative().optional(),
|
|
97
|
+
updatedAt: z.string().max(40).optional(),
|
|
98
|
+
offers: z.array(OfferSchema).max(40),
|
|
99
|
+
});
|
|
100
|
+
//# sourceMappingURL=offer-schemas.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"offer-schemas.js","sourceRoot":"","sources":["../../../src/models/offer-schemas.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;GAoBG;AACH,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AAExB,+EAA+E;AAC/E,kGAAkG;AAClG,uGAAuG;AACvG,MAAM,WAAW,GAAG,CAAC,CAAC,MAAM,CAAC;IAC3B,OAAO,EAAE,CAAC,CAAC,MAAM,EAAE,CAAC,GAAG,EAAE,CAAC,WAAW,EAAE;IACvC,IAAI,EAAE,CAAC,CAAC,IAAI,CAAC,CAAC,UAAU,EAAE,YAAY,EAAE,cAAc,CAAC,CAAC,CAAC,QAAQ,EAAE,EAAE,uCAAuC;CAC7G,CAAC,CAAC,QAAQ,EAAE,CAAC;AAEd,+GAA+G;AAC/G,MAAM,cAAc,GAAG,CAAC,CAAC,MAAM,CAAC;IAC9B,SAAS,EAAE,CAAC,CAAC,MAAM,EAAE,CAAC,GAAG,CAAC,GAAG,CAAC,CAAC,QAAQ,EAAE,EAAI,yDAAyD;IACtG,WAAW,EAAE,CAAC,CAAC,MAAM,EAAE,CAAC,GAAG,CAAC,GAAG,CAAC,CAAC,QAAQ,EAAE,EAAE,sBAAsB;IACnE,YAAY,EAAE,CAAC,CAAC,MAAM,CAAC,CAAC,CAAC,MAAM,EAAE,EAAE,CAAC,CAAC,OAAO,EAAE,CAAC,CAAC,QAAQ,EAAE;IAC1D,aAAa,EAAE,CAAC,CAAC,MAAM,CAAC,CAAC,CAAC,MAAM,EAAE,EAAE,CAAC,CAAC,OAAO,EAAE,CAAC,CAAC,QAAQ,EAAE;CAC5D,CAAC,CAAC,QAAQ,EAAE,CAAC;AAEd,MAAM,iBAAiB,GAAG,CAAC,CAAC,MAAM,CAAC;I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":"agent-tasks.d.ts","sourceRoot":"","sources":["../../../src/routes/agent-tasks.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA+BG;AAEH,OAAO,EAAE,MAAM,EAAE,MAAM,SAAS,CAAC;AAEjC,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,cAAc,CAAC;AACjD,OAAO,KAAK,EAAE,OAAO,EAA8E,MAAM,yBAAyB,CAAC;AAYnI,OAAO,KAAK,EAAE,uBAAuB,EAAE,MAAM,mCAAmC,CAAC;AAEjF,KAAK,iBAAiB,GAAG,UAAU,CAAC,OAAO,uBAAuB,CAAC,CAAC;AAsBpE,wBAAgB,gBAAgB,CAAC,MAAM,EAAE,YAAY,EAAE,OAAO,EAAE,OAAO,EAAE,iBAAiB,CAAC,EAAE,iBAAiB,GAAG,MAAM,
|
|
1
|
+
{"version":3,"file":"agent-tasks.d.ts","sourceRoot":"","sources":["../../../src/routes/agent-tasks.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA+BG;AAEH,OAAO,EAAE,MAAM,EAAE,MAAM,SAAS,CAAC;AAEjC,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,cAAc,CAAC;AACjD,OAAO,KAAK,EAAE,OAAO,EAA8E,MAAM,yBAAyB,CAAC;AAYnI,OAAO,KAAK,EAAE,uBAAuB,EAAE,MAAM,mCAAmC,CAAC;AAEjF,KAAK,iBAAiB,GAAG,UAAU,CAAC,OAAO,uBAAuB,CAAC,CAAC;AAsBpE,wBAAgB,gBAAgB,CAAC,MAAM,EAAE,YAAY,EAAE,OAAO,EAAE,OAAO,EAAE,iBAAiB,CAAC,EAAE,iBAAiB,GAAG,MAAM,CAqvCtH"}
|
|
@@ -1160,6 +1160,39 @@ export function agentTasksRouter(config, storage, webhookDispatcher) {
|
|
|
1160
1160
|
per_page: perPage,
|
|
1161
1161
|
}));
|
|
1162
1162
|
});
|
|
1163
|
+
/* ── GET /v1/deliverables — the Offers "Inbox": everything that came back, across ALL agents ──
|
|
1164
|
+
* Owner aggregate of non-draft tasks (queued/active/done/failed/…), newest first, with provenance
|
|
1165
|
+
* (agent, status, timestamps), the deliverable key, the verification expectation, and any existing
|
|
1166
|
+
* rating. The follow-up half of the Offers surface — check + rate without clicking through agents.
|
|
1167
|
+
* Failures are included AS failures (status='failed'); rate the deliverable via the locked
|
|
1168
|
+
* POST /v1/agents/:name/tasks/:id/rate. */
|
|
1169
|
+
router.get('/v1/deliverables', requireAuth(), requireRole('owner'), async (req, res) => {
|
|
1170
|
+
const owner = resolve(req);
|
|
1171
|
+
const all = [];
|
|
1172
|
+
for (let p = 1; p <= 10; p++) {
|
|
1173
|
+
const r = await storage.listAgentTasksByOwner(owner, { page: p, perPage: 200 });
|
|
1174
|
+
all.push(...r.tasks);
|
|
1175
|
+
if (r.tasks.length < 200)
|
|
1176
|
+
break;
|
|
1177
|
+
}
|
|
1178
|
+
const deliverables = all
|
|
1179
|
+
.filter(t => t.status !== 'draft')
|
|
1180
|
+
.sort((a, b) => String(b.updatedAt).localeCompare(String(a.updatedAt)))
|
|
1181
|
+
.slice(0, 100)
|
|
1182
|
+
.map(t => ({
|
|
1183
|
+
task_id: t.id,
|
|
1184
|
+
agent: t.agentGaii.split('#')[0],
|
|
1185
|
+
agent_gaii: t.agentGaii, // full GAII so the Inbox can read the agent's memory namespace
|
|
1186
|
+
title: t.title,
|
|
1187
|
+
status: t.status,
|
|
1188
|
+
completed_at: t.completedAt ?? null,
|
|
1189
|
+
updated_at: t.updatedAt,
|
|
1190
|
+
deliverable_key: t.deliverableKey ?? null,
|
|
1191
|
+
verification: t.verification?.userExpects ?? null,
|
|
1192
|
+
rating: t.rating ?? null,
|
|
1193
|
+
}));
|
|
1194
|
+
res.json(success(config.nodeId, { deliverables, total: deliverables.length }));
|
|
1195
|
+
});
|
|
1163
1196
|
return router;
|
|
1164
1197
|
}
|
|
1165
1198
|
//# sourceMappingURL=agent-tasks.js.map
|