agnets done

This commit is contained in:
2026-08-28 11:02:02 +05:30
parent ab9adde6cd
commit eaf08e061d
58 changed files with 3506 additions and 4308 deletions

View File

@@ -11,16 +11,19 @@
*
* React → base44Client.js → HTTP → Go API → PostgreSQL
*
* The entity surface is unchanged. `store.js` and `seed.js` are no longer the
* source of data — the seeded dataset now lives in PostgreSQL, loaded by the
* backend's `make seed`. `seed.js` is still imported for one thing: the shape
* of the demo user's default preferences, which the synchronous accessor below
* needs before the first response arrives.
* The entity surface is unchanged. The seeded dataset lives in PostgreSQL,
* loaded by the backend's `make seed`, and nothing in the running app carries a
* copy of it: `store.js` — the localStorage database this replaced — is gone,
* and `seed.js` is now a test fixture that no production module imports.
*
* The one thing still needed before the first response arrives is the *shape*
* of the user's default preferences, because the accessor that reads them is
* synchronous. That is `api/demoUser.js`: a default shape, not a record.
*/
import { createEntity, request, isUnauthenticated, API_BASE_URL } from './httpClient';
import { invokeLLM, uploadFile } from './aiEngine';
import { DEMO_USER } from './seed';
import { DEMO_USER } from './demoUser';
const ENTITY_NAMES = [
'JobPosting', 'JobApplication', 'AIInterview', 'Staff', 'WorkerProfile',
@@ -33,6 +36,14 @@ const ENTITY_NAMES = [
/* Shifts worked, missed and overrun. The operational record behind
attendance and overtime analysis — see `api/attendanceSeed.js`. */
'ShiftRecord',
/* The agent and skill registry the runtime resolves from.
Authored definitions used to be written into the account's preferences,
which the backend stores faithfully and the runtime never reads — so an
agent created in the editor showed as "published" and answered every
request with 404. These are the endpoints that make an authored agent a
real one. */
'AgentDefinition',
'SkillDefinition',
];
const entities = Object.fromEntries(
@@ -210,7 +221,7 @@ const auth = {
* Preferences, read synchronously.
*
* A plain read of the same record `me()` returns, defaulted with the shape
* from `seed.js` so a key the server has never stored still resolves. See the
* from `demoUser.js` so a key the server has never stored still resolves. See the
* note on `currentUser` for why this must not become async.
*/
preferences() {
@@ -327,6 +338,41 @@ const workflows = {
},
};
/* ── Owliver ────────────────────────────────────────────────────────────── */
/**
* What could usefully be asked on this page.
*
* The one read in this file that is not a table. `GET /owliver/suggestions`
* answers with at most three questions, and the server decides all three: it
* filters them against the caller's role through the same policy table every
* other endpoint consults, and — when nothing has been typed — ranks them
* against the organization's actual state in PostgreSQL. A workspace with
* unfinished drafts is asked about drafts; one with unscored candidates is
* asked about screening.
*
* Nothing is ranked, scored, filtered or reordered on this side. That is the
* point: a suggestion is a claim that the reader could usefully ask something,
* and the only thing that knows whether that is true is the thing holding the
* data and the permissions. The panel requests, renders, and runs whichever one
* is chosen through the capability it names.
*
* `query` is what is in the composer. Sent only when it is non-empty: an absent
* query asks the data what to suggest, and an empty string would be a different
* request from the one the caller means.
*/
const owliver = {
/** @param {any} request */
async suggestions({ page, query = '' } = {}) {
if (!page) return [];
const typed = String(query || '').trim();
const data = await request('GET', '/owliver/suggestions', {
query: { page, ...(typed ? { query: typed } : {}) },
});
return Array.isArray(data?.suggestions) ? data.suggestions : [];
},
};
/* ── Integrations & analytics ───────────────────────────────────────────── */
const integrations = {
@@ -344,7 +390,7 @@ const analytics = {
},
};
export const base44 = { entities, auth, integrations, analytics, workflows };
export const base44 = { entities, auth, integrations, analytics, workflows, owliver };
/** Where the entity data actually comes from, for diagnostics. */
export { API_BASE_URL };