forge-openclaw-plugin 0.2.24 → 0.2.26
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +13 -0
- package/dist/assets/{board-_C6oMy5w.js → board-ta0rUHOf.js} +3 -3
- package/dist/assets/{board-_C6oMy5w.js.map → board-ta0rUHOf.js.map} +1 -1
- package/dist/assets/index-Ro0ZF_az.css +1 -0
- package/dist/assets/index-ytlpSj23.js +79 -0
- package/dist/assets/index-ytlpSj23.js.map +1 -0
- package/dist/assets/{motion-D4sZgCHd.js → motion-fBKPB6yw.js} +3 -3
- package/dist/assets/motion-fBKPB6yw.js.map +1 -0
- package/dist/assets/{table-BWzTaky1.js → table-C-IGTQni.js} +2 -2
- package/dist/assets/{table-BWzTaky1.js.map → table-C-IGTQni.js.map} +1 -1
- package/dist/assets/{ui-BzK4azQb.js → ui-DInOpaYF.js} +2 -2
- package/dist/assets/{ui-BzK4azQb.js.map → ui-DInOpaYF.js.map} +1 -1
- package/dist/assets/vendor-lE3tZJcC.js +876 -0
- package/dist/assets/vendor-lE3tZJcC.js.map +1 -0
- package/dist/index.html +7 -8
- package/dist/openclaw/local-runtime.d.ts +3 -1
- package/dist/openclaw/local-runtime.js +51 -15
- package/dist/openclaw/parity.d.ts +1 -1
- package/dist/openclaw/parity.js +29 -0
- package/dist/openclaw/plugin-entry-shared.d.ts +1 -0
- package/dist/openclaw/plugin-entry-shared.js +31 -6
- package/dist/openclaw/plugin-sdk-types.d.ts +29 -0
- package/dist/openclaw/routes.js +236 -0
- package/dist/openclaw/session-bootstrap.d.ts +78 -0
- package/dist/openclaw/session-bootstrap.js +240 -0
- package/dist/openclaw/tools.js +279 -6
- package/dist/server/server/migrations/001_core.sql +411 -0
- package/dist/server/server/migrations/002_psyche.sql +392 -0
- package/dist/server/server/migrations/003_habits.sql +30 -0
- package/dist/server/server/migrations/004_habit_links.sql +8 -0
- package/dist/server/server/migrations/005_habit_psyche_links.sql +24 -0
- package/dist/server/server/migrations/006_work_adjustments.sql +14 -0
- package/dist/server/server/migrations/007_weekly_review_closures.sql +17 -0
- package/dist/server/server/migrations/008_calendar_execution.sql +147 -0
- package/dist/server/server/migrations/009_true_calendar_events.sql +195 -0
- package/dist/server/server/migrations/010_calendar_selection_state.sql +6 -0
- package/dist/server/server/migrations/011_calendar_timezone_backfill.sql +11 -0
- package/dist/server/server/migrations/012_work_block_ranges.sql +7 -0
- package/dist/server/server/migrations/013_microsoft_local_auth_settings.sql +8 -0
- package/dist/server/server/migrations/014_note_tags_and_ephemeral.sql +8 -0
- package/dist/server/server/migrations/015_multi_user_and_strategies.sql +244 -0
- package/dist/server/server/migrations/016_health_companion.sql +158 -0
- package/dist/server/server/migrations/016_strategy_contracts_and_user_graph.sql +22 -0
- package/dist/server/server/migrations/017_preferences.sql +131 -0
- package/dist/server/server/migrations/018_preference_catalogs.sql +31 -0
- package/dist/server/server/migrations/019_wiki_memory.sql +255 -0
- package/dist/server/server/migrations/020_wiki_page_hierarchy.sql +11 -0
- package/dist/server/server/migrations/021_hide_evidence_from_wiki_index.sql +3 -0
- package/dist/server/server/migrations/022_wiki_ingest_background.sql +85 -0
- package/dist/server/server/migrations/023_diagnostic_logs.sql +28 -0
- package/dist/server/server/migrations/024_questionnaires.sql +96 -0
- package/dist/server/server/migrations/025_ai_model_connections.sql +26 -0
- package/dist/server/server/migrations/026_custom_theme_settings.sql +2 -0
- package/dist/server/server/migrations/027_ai_processors.sql +31 -0
- package/dist/server/server/migrations/028_movement_domain.sql +136 -0
- package/dist/server/server/migrations/029_watch_micro_capture.sql +23 -0
- package/dist/server/server/migrations/030_surface_layouts.sql +5 -0
- package/dist/server/server/migrations/031_ai_processor_runtime_upgrades.sql +10 -0
- package/dist/server/server/migrations/032_ai_connectors.sql +44 -0
- package/dist/server/server/migrations/033_movement_trip_point_sync.sql +36 -0
- package/dist/server/server/migrations/034_movement_segment_sync.sql +49 -0
- package/dist/server/server/migrations/035_google_local_auth_settings.sql +2 -0
- package/dist/server/server/migrations/036_google_local_auth_client_secret.sql +2 -0
- package/dist/server/{app.js → server/src/app.js} +992 -25
- package/dist/server/server/src/connectors/box-registry.js +188 -0
- package/dist/server/{db.js → server/src/db.js} +6 -0
- package/dist/server/server/src/debug.js +19 -0
- package/dist/server/server/src/discovery-advertiser.js +114 -0
- package/dist/server/{health.js → server/src/health.js} +39 -11
- package/dist/server/{index.js → server/src/index.js} +4 -0
- package/dist/server/{managers → server/src/managers}/platform/llm-manager.js +40 -4
- package/dist/server/{managers → server/src/managers}/platform/openai-responses-provider.js +129 -19
- package/dist/server/server/src/movement.js +2935 -0
- package/dist/server/{openapi.js → server/src/openapi.js} +628 -5
- package/dist/server/{psyche-types.js → server/src/psyche-types.js} +15 -1
- package/dist/server/server/src/questionnaire-flow.js +552 -0
- package/dist/server/server/src/questionnaire-seeds.js +853 -0
- package/dist/server/server/src/questionnaire-types.js +340 -0
- package/dist/server/server/src/repositories/ai-connectors.js +1207 -0
- package/dist/server/server/src/repositories/ai-processors.js +547 -0
- package/dist/server/{repositories → server/src/repositories}/calendar.js +1 -1
- package/dist/server/{repositories → server/src/repositories}/entity-ownership.js +9 -1
- package/dist/server/{repositories → server/src/repositories}/habits.js +69 -5
- package/dist/server/server/src/repositories/model-settings.js +216 -0
- package/dist/server/{repositories → server/src/repositories}/notes.js +57 -15
- package/dist/server/{repositories → server/src/repositories}/preferences.js +124 -0
- package/dist/server/server/src/repositories/questionnaires.js +1338 -0
- package/dist/server/{repositories → server/src/repositories}/settings.js +156 -12
- package/dist/server/server/src/repositories/surface-layouts.js +76 -0
- package/dist/server/{repositories → server/src/repositories}/wiki-memory.js +5 -1
- package/dist/server/{services → server/src/services}/calendar-runtime.js +775 -58
- package/dist/server/{services → server/src/services}/entity-crud.js +81 -2
- package/dist/server/server/src/services/google-calendar-oauth-config.js +176 -0
- package/dist/server/server/src/services/openai-codex-oauth.js +153 -0
- package/dist/server/server/src/services/psyche-observation-calendar.js +46 -0
- package/dist/server/{types.js → server/src/types.js} +621 -14
- package/dist/server/server/src/watch-mobile.js +562 -0
- package/dist/server/{web.js → server/src/web.js} +30 -4
- package/dist/server/src/components/customization/utility-widgets.js +330 -0
- package/dist/server/src/components/workbench-boxes/health/health-boxes.js +92 -0
- package/dist/server/src/components/workbench-boxes/kanban/kanban-boxes.js +128 -0
- package/dist/server/src/components/workbench-boxes/movement/movement-boxes.js +37 -0
- package/dist/server/src/components/workbench-boxes/notes/notes-boxes.js +114 -0
- package/dist/server/src/components/workbench-boxes/projects/projects-boxes.js +57 -0
- package/dist/server/src/components/workbench-boxes/shared/define-workbench-box.js +4 -0
- package/dist/server/src/components/workbench-boxes/shared/generic-node-view.js +13 -0
- package/dist/server/src/components/workbench-boxes/today/today-boxes.js +63 -0
- package/dist/server/src/lib/api-error.js +37 -0
- package/dist/server/src/lib/api.js +1859 -0
- package/dist/server/src/lib/calendar-name-deduper.js +144 -0
- package/dist/server/src/lib/diagnostics.js +67 -0
- package/dist/server/src/lib/psyche-types.js +1 -0
- package/dist/server/src/lib/questionnaire-types.js +1 -0
- package/dist/server/src/lib/runtime-paths.js +24 -0
- package/dist/server/src/lib/schemas.js +234 -0
- package/dist/server/src/lib/snapshot-normalizer.js +374 -0
- package/dist/server/src/lib/theme-system.js +319 -0
- package/dist/server/src/lib/types.js +1 -0
- package/dist/server/src/lib/utils.js +22 -0
- package/dist/server/src/lib/workbench/boxes.js +16 -0
- package/dist/server/src/lib/workbench/nodes.js +15 -0
- package/dist/server/src/lib/workbench/registry.js +73 -0
- package/dist/server/src/lib/workbench/runtime.js +181 -0
- package/openclaw.plugin.json +1 -1
- package/package.json +6 -1
- package/server/index.js +68 -0
- package/server/migrations/024_questionnaires.sql +96 -0
- package/server/migrations/025_ai_model_connections.sql +26 -0
- package/server/migrations/026_custom_theme_settings.sql +2 -0
- package/server/migrations/027_ai_processors.sql +31 -0
- package/server/migrations/028_movement_domain.sql +136 -0
- package/server/migrations/029_watch_micro_capture.sql +23 -0
- package/server/migrations/030_surface_layouts.sql +5 -0
- package/server/migrations/031_ai_processor_runtime_upgrades.sql +10 -0
- package/server/migrations/032_ai_connectors.sql +44 -0
- package/server/migrations/033_movement_trip_point_sync.sql +36 -0
- package/server/migrations/034_movement_segment_sync.sql +49 -0
- package/server/migrations/035_google_local_auth_settings.sql +2 -0
- package/server/migrations/036_google_local_auth_client_secret.sql +2 -0
- package/skills/forge-openclaw/SKILL.md +15 -1
- package/skills/forge-openclaw/entity_conversation_playbooks.md +523 -87
- package/skills/forge-openclaw/psyche_entity_playbooks.md +331 -221
- package/dist/assets/index-DTCwBWAs.js +0 -65
- package/dist/assets/index-DTCwBWAs.js.map +0 -1
- package/dist/assets/index-DttXlAgi.css +0 -1
- package/dist/assets/motion-D4sZgCHd.js.map +0 -1
- package/dist/assets/vendor-De38P6YR.js +0 -729
- package/dist/assets/vendor-De38P6YR.js.map +0 -1
- package/dist/assets/viz-C6hfyqzu.js +0 -34
- package/dist/assets/viz-C6hfyqzu.js.map +0 -1
- package/skills/forge-openclaw/cron_jobs.md +0 -395
- /package/dist/server/{demo-data.js → server/src/demo-data.js} +0 -0
- /package/dist/server/{e2e-server.js → server/src/e2e-server.js} +0 -0
- /package/dist/server/{errors.js → server/src/errors.js} +0 -0
- /package/dist/server/{managers → server/src/managers}/base.js +0 -0
- /package/dist/server/{managers → server/src/managers}/contracts.js +0 -0
- /package/dist/server/{managers → server/src/managers}/platform/api-gateway-manager.js +0 -0
- /package/dist/server/{managers → server/src/managers}/platform/audit-manager.js +0 -0
- /package/dist/server/{managers → server/src/managers}/platform/authentication-manager.js +0 -0
- /package/dist/server/{managers → server/src/managers}/platform/authorization-manager.js +0 -0
- /package/dist/server/{managers → server/src/managers}/platform/background-job-manager.js +0 -0
- /package/dist/server/{managers → server/src/managers}/platform/configuration-manager.js +0 -0
- /package/dist/server/{managers → server/src/managers}/platform/database-manager.js +0 -0
- /package/dist/server/{managers → server/src/managers}/platform/event-bus-manager.js +0 -0
- /package/dist/server/{managers → server/src/managers}/platform/external-service-manager.js +0 -0
- /package/dist/server/{managers → server/src/managers}/platform/health-manager.js +0 -0
- /package/dist/server/{managers → server/src/managers}/platform/migration-manager.js +0 -0
- /package/dist/server/{managers → server/src/managers}/platform/search-index-manager.js +0 -0
- /package/dist/server/{managers → server/src/managers}/platform/secrets-manager.js +0 -0
- /package/dist/server/{managers → server/src/managers}/platform/session-manager.js +0 -0
- /package/dist/server/{managers → server/src/managers}/platform/storage-manager.js +0 -0
- /package/dist/server/{managers → server/src/managers}/platform/token-manager.js +0 -0
- /package/dist/server/{managers → server/src/managers}/platform/transaction-manager.js +0 -0
- /package/dist/server/{managers → server/src/managers}/platform/trusted-network.js +0 -0
- /package/dist/server/{managers → server/src/managers}/runtime.js +0 -0
- /package/dist/server/{managers → server/src/managers}/type-guards.js +0 -0
- /package/dist/server/{preferences-seeds.js → server/src/preferences-seeds.js} +0 -0
- /package/dist/server/{preferences-types.js → server/src/preferences-types.js} +0 -0
- /package/dist/server/{repositories → server/src/repositories}/activity-events.js +0 -0
- /package/dist/server/{repositories → server/src/repositories}/collaboration.js +0 -0
- /package/dist/server/{repositories → server/src/repositories}/deleted-entities.js +0 -0
- /package/dist/server/{repositories → server/src/repositories}/diagnostic-logs.js +0 -0
- /package/dist/server/{repositories → server/src/repositories}/domains.js +0 -0
- /package/dist/server/{repositories → server/src/repositories}/event-log.js +0 -0
- /package/dist/server/{repositories → server/src/repositories}/goals.js +0 -0
- /package/dist/server/{repositories → server/src/repositories}/projects.js +0 -0
- /package/dist/server/{repositories → server/src/repositories}/psyche.js +0 -0
- /package/dist/server/{repositories → server/src/repositories}/rewards.js +0 -0
- /package/dist/server/{repositories → server/src/repositories}/strategies.js +0 -0
- /package/dist/server/{repositories → server/src/repositories}/tags.js +0 -0
- /package/dist/server/{repositories → server/src/repositories}/task-runs.js +0 -0
- /package/dist/server/{repositories → server/src/repositories}/tasks.js +0 -0
- /package/dist/server/{repositories → server/src/repositories}/users.js +0 -0
- /package/dist/server/{repositories → server/src/repositories}/weekly-reviews.js +0 -0
- /package/dist/server/{repositories → server/src/repositories}/work-adjustments.js +0 -0
- /package/dist/server/{seed-demo.js → server/src/seed-demo.js} +0 -0
- /package/dist/server/{services → server/src/services}/context.js +0 -0
- /package/dist/server/{services → server/src/services}/dashboard.js +0 -0
- /package/dist/server/{services → server/src/services}/gamification.js +0 -0
- /package/dist/server/{services → server/src/services}/insights.js +0 -0
- /package/dist/server/{services → server/src/services}/projects.js +0 -0
- /package/dist/server/{services → server/src/services}/psyche.js +0 -0
- /package/dist/server/{services → server/src/services}/relations.js +0 -0
- /package/dist/server/{services → server/src/services}/reviews.js +0 -0
- /package/dist/server/{services → server/src/services}/run-recovery.js +0 -0
- /package/dist/server/{services → server/src/services}/tagging.js +0 -0
- /package/dist/server/{services → server/src/services}/task-run-watchdog.js +0 -0
- /package/dist/server/{services → server/src/services}/work-time.js +0 -0
|
@@ -0,0 +1,1859 @@
|
|
|
1
|
+
import { ForgeApiError } from "./api-error.js";
|
|
2
|
+
import { dedupeCalendarDiscoveryPayload, dedupeCalendarOverviewPayload } from "./calendar-name-deduper.js";
|
|
3
|
+
import { publishUiDiagnosticLog } from "./diagnostics.js";
|
|
4
|
+
import { resolveForgePath } from "./runtime-paths.js";
|
|
5
|
+
import { normalizeForgeSnapshot } from "./snapshot-normalizer.js";
|
|
6
|
+
function normalizeCalendarEventPlace(event) {
|
|
7
|
+
const fallbackLocation = typeof event.location === "string" ? event.location : "";
|
|
8
|
+
const place = event.place ?? {
|
|
9
|
+
label: fallbackLocation,
|
|
10
|
+
address: "",
|
|
11
|
+
timezone: "",
|
|
12
|
+
latitude: null,
|
|
13
|
+
longitude: null,
|
|
14
|
+
source: "",
|
|
15
|
+
externalPlaceId: ""
|
|
16
|
+
};
|
|
17
|
+
return {
|
|
18
|
+
...event,
|
|
19
|
+
place: {
|
|
20
|
+
label: place.label || fallbackLocation,
|
|
21
|
+
address: place.address ?? "",
|
|
22
|
+
timezone: place.timezone ?? "",
|
|
23
|
+
latitude: place.latitude ?? null,
|
|
24
|
+
longitude: place.longitude ?? null,
|
|
25
|
+
source: place.source ?? "",
|
|
26
|
+
externalPlaceId: place.externalPlaceId ?? ""
|
|
27
|
+
}
|
|
28
|
+
};
|
|
29
|
+
}
|
|
30
|
+
function normalizeCalendarOverviewPayload(payload) {
|
|
31
|
+
return {
|
|
32
|
+
...dedupeCalendarOverviewPayload(payload),
|
|
33
|
+
events: payload.events.map(normalizeCalendarEventPlace)
|
|
34
|
+
};
|
|
35
|
+
}
|
|
36
|
+
async function parseResponseBody(response) {
|
|
37
|
+
const text = await response.text();
|
|
38
|
+
if (!text) {
|
|
39
|
+
return null;
|
|
40
|
+
}
|
|
41
|
+
try {
|
|
42
|
+
return JSON.parse(text);
|
|
43
|
+
}
|
|
44
|
+
catch {
|
|
45
|
+
return text;
|
|
46
|
+
}
|
|
47
|
+
}
|
|
48
|
+
async function request(path, init) {
|
|
49
|
+
const headers = new Headers(init?.headers);
|
|
50
|
+
headers.set("x-forge-source", "ui");
|
|
51
|
+
if (init?.body !== undefined &&
|
|
52
|
+
!(typeof FormData !== "undefined" && init.body instanceof FormData) &&
|
|
53
|
+
!headers.has("content-type")) {
|
|
54
|
+
headers.set("content-type", "application/json");
|
|
55
|
+
}
|
|
56
|
+
let response;
|
|
57
|
+
try {
|
|
58
|
+
response = await fetch(resolveForgePath(path), {
|
|
59
|
+
credentials: "same-origin",
|
|
60
|
+
headers,
|
|
61
|
+
...init
|
|
62
|
+
});
|
|
63
|
+
}
|
|
64
|
+
catch (error) {
|
|
65
|
+
if (path !== "/api/v1/diagnostics/logs") {
|
|
66
|
+
void publishUiDiagnosticLog({
|
|
67
|
+
level: "error",
|
|
68
|
+
scope: "frontend_api",
|
|
69
|
+
eventKey: "request_network_failure",
|
|
70
|
+
message: `API request failed before reaching Forge: ${path}`,
|
|
71
|
+
route: path,
|
|
72
|
+
functionName: "request",
|
|
73
|
+
details: {
|
|
74
|
+
error: error instanceof Error
|
|
75
|
+
? {
|
|
76
|
+
name: error.name,
|
|
77
|
+
message: error.message,
|
|
78
|
+
stack: error.stack ?? null
|
|
79
|
+
}
|
|
80
|
+
: String(error)
|
|
81
|
+
}
|
|
82
|
+
});
|
|
83
|
+
}
|
|
84
|
+
throw error;
|
|
85
|
+
}
|
|
86
|
+
const body = await parseResponseBody(response);
|
|
87
|
+
if (!response.ok) {
|
|
88
|
+
const maybeBody = typeof body === "object" && body !== null
|
|
89
|
+
? body
|
|
90
|
+
: null;
|
|
91
|
+
const details = Array.isArray(maybeBody?.details)
|
|
92
|
+
? maybeBody.details
|
|
93
|
+
: [];
|
|
94
|
+
if (path !== "/api/v1/diagnostics/logs") {
|
|
95
|
+
void publishUiDiagnosticLog({
|
|
96
|
+
level: response.status >= 500 ? "error" : "warning",
|
|
97
|
+
scope: "frontend_api",
|
|
98
|
+
eventKey: "request_failed",
|
|
99
|
+
message: `API request failed: ${path}`,
|
|
100
|
+
route: path,
|
|
101
|
+
functionName: "request",
|
|
102
|
+
details: {
|
|
103
|
+
statusCode: response.status,
|
|
104
|
+
code: typeof maybeBody?.code === "string"
|
|
105
|
+
? maybeBody.code
|
|
106
|
+
: typeof maybeBody?.error === "string"
|
|
107
|
+
? maybeBody.error
|
|
108
|
+
: "request_failed",
|
|
109
|
+
response: typeof body === "string"
|
|
110
|
+
? body
|
|
111
|
+
: body && typeof body === "object"
|
|
112
|
+
? body
|
|
113
|
+
: null,
|
|
114
|
+
validationIssues: details
|
|
115
|
+
}
|
|
116
|
+
});
|
|
117
|
+
}
|
|
118
|
+
throw new ForgeApiError({
|
|
119
|
+
status: response.status,
|
|
120
|
+
code: typeof maybeBody?.code === "string"
|
|
121
|
+
? maybeBody.code
|
|
122
|
+
: typeof maybeBody?.error === "string"
|
|
123
|
+
? maybeBody.error
|
|
124
|
+
: "request_failed",
|
|
125
|
+
message: typeof maybeBody?.error === "string"
|
|
126
|
+
? maybeBody.error
|
|
127
|
+
: typeof maybeBody?.message === "string"
|
|
128
|
+
? maybeBody.message
|
|
129
|
+
: typeof body === "string"
|
|
130
|
+
? body
|
|
131
|
+
: `Request failed: ${response.status}`,
|
|
132
|
+
requestPath: path,
|
|
133
|
+
details
|
|
134
|
+
});
|
|
135
|
+
}
|
|
136
|
+
return body;
|
|
137
|
+
}
|
|
138
|
+
function normalizeNestedNotes(notes) {
|
|
139
|
+
return notes
|
|
140
|
+
.map((note) => ({
|
|
141
|
+
contentMarkdown: note.contentMarkdown.trim(),
|
|
142
|
+
author: note.author.trim() || null
|
|
143
|
+
}))
|
|
144
|
+
.filter((note) => note.contentMarkdown.length > 0);
|
|
145
|
+
}
|
|
146
|
+
const USER_SCOPE_STORAGE_KEY = "forge.selected-user-ids";
|
|
147
|
+
function readStoredUserIds() {
|
|
148
|
+
if (typeof window === "undefined") {
|
|
149
|
+
return [];
|
|
150
|
+
}
|
|
151
|
+
try {
|
|
152
|
+
const raw = window.localStorage.getItem(USER_SCOPE_STORAGE_KEY);
|
|
153
|
+
if (!raw) {
|
|
154
|
+
return [];
|
|
155
|
+
}
|
|
156
|
+
const parsed = JSON.parse(raw);
|
|
157
|
+
if (!Array.isArray(parsed)) {
|
|
158
|
+
return [];
|
|
159
|
+
}
|
|
160
|
+
return parsed
|
|
161
|
+
.filter((entry) => typeof entry === "string")
|
|
162
|
+
.map((entry) => entry.trim())
|
|
163
|
+
.filter(Boolean);
|
|
164
|
+
}
|
|
165
|
+
catch {
|
|
166
|
+
return [];
|
|
167
|
+
}
|
|
168
|
+
}
|
|
169
|
+
function resolveScopedUserIds(userIds) {
|
|
170
|
+
return userIds ?? readStoredUserIds();
|
|
171
|
+
}
|
|
172
|
+
function coerceUserIds(value) {
|
|
173
|
+
return Array.isArray(value)
|
|
174
|
+
? value.filter((entry) => typeof entry === "string")
|
|
175
|
+
: undefined;
|
|
176
|
+
}
|
|
177
|
+
function appendUserIds(search, userIds) {
|
|
178
|
+
for (const userId of resolveScopedUserIds(userIds)) {
|
|
179
|
+
if (userId.trim()) {
|
|
180
|
+
search.append("userIds", userId.trim());
|
|
181
|
+
}
|
|
182
|
+
}
|
|
183
|
+
}
|
|
184
|
+
export function ensureOperatorSession() {
|
|
185
|
+
return request("/api/v1/auth/operator-session");
|
|
186
|
+
}
|
|
187
|
+
export function revokeOperatorSession() {
|
|
188
|
+
return request("/api/v1/auth/operator-session", {
|
|
189
|
+
method: "DELETE"
|
|
190
|
+
});
|
|
191
|
+
}
|
|
192
|
+
export function getForgeSnapshot(userIds) {
|
|
193
|
+
const search = new URLSearchParams();
|
|
194
|
+
appendUserIds(search, coerceUserIds(userIds));
|
|
195
|
+
const suffix = search.size > 0 ? `?${search.toString()}` : "";
|
|
196
|
+
return request(`/api/v1/context${suffix}`).then(normalizeForgeSnapshot);
|
|
197
|
+
}
|
|
198
|
+
export function getPreferenceWorkspace(query) {
|
|
199
|
+
const search = new URLSearchParams();
|
|
200
|
+
if (query.userId) {
|
|
201
|
+
search.set("userId", query.userId);
|
|
202
|
+
}
|
|
203
|
+
if (query.domain) {
|
|
204
|
+
search.set("domain", query.domain);
|
|
205
|
+
}
|
|
206
|
+
if (query.contextId) {
|
|
207
|
+
search.set("contextId", query.contextId);
|
|
208
|
+
}
|
|
209
|
+
const suffix = search.size > 0 ? `?${search.toString()}` : "";
|
|
210
|
+
return request(`/api/v1/preferences/workspace${suffix}`);
|
|
211
|
+
}
|
|
212
|
+
export function startPreferenceGame(input) {
|
|
213
|
+
return request("/api/v1/preferences/game/start", {
|
|
214
|
+
method: "POST",
|
|
215
|
+
body: JSON.stringify(input)
|
|
216
|
+
});
|
|
217
|
+
}
|
|
218
|
+
export function createPreferenceCatalog(input) {
|
|
219
|
+
return request("/api/v1/preferences/catalogs", {
|
|
220
|
+
method: "POST",
|
|
221
|
+
body: JSON.stringify(input)
|
|
222
|
+
});
|
|
223
|
+
}
|
|
224
|
+
export function patchPreferenceCatalog(catalogId, patch) {
|
|
225
|
+
return request(`/api/v1/preferences/catalogs/${catalogId}`, {
|
|
226
|
+
method: "PATCH",
|
|
227
|
+
body: JSON.stringify(patch)
|
|
228
|
+
});
|
|
229
|
+
}
|
|
230
|
+
export function deletePreferenceCatalog(catalogId) {
|
|
231
|
+
return request(`/api/v1/preferences/catalogs/${catalogId}`, {
|
|
232
|
+
method: "DELETE"
|
|
233
|
+
});
|
|
234
|
+
}
|
|
235
|
+
export function createPreferenceCatalogItem(input) {
|
|
236
|
+
return request("/api/v1/preferences/catalog-items", {
|
|
237
|
+
method: "POST",
|
|
238
|
+
body: JSON.stringify(input)
|
|
239
|
+
});
|
|
240
|
+
}
|
|
241
|
+
export function patchPreferenceCatalogItem(catalogItemId, patch) {
|
|
242
|
+
return request(`/api/v1/preferences/catalog-items/${catalogItemId}`, {
|
|
243
|
+
method: "PATCH",
|
|
244
|
+
body: JSON.stringify(patch)
|
|
245
|
+
});
|
|
246
|
+
}
|
|
247
|
+
export function deletePreferenceCatalogItem(catalogItemId) {
|
|
248
|
+
return request(`/api/v1/preferences/catalog-items/${catalogItemId}`, {
|
|
249
|
+
method: "DELETE"
|
|
250
|
+
});
|
|
251
|
+
}
|
|
252
|
+
export function createPreferenceContext(input) {
|
|
253
|
+
return request("/api/v1/preferences/contexts", {
|
|
254
|
+
method: "POST",
|
|
255
|
+
body: JSON.stringify(input)
|
|
256
|
+
});
|
|
257
|
+
}
|
|
258
|
+
export function patchPreferenceContext(contextId, patch) {
|
|
259
|
+
return request(`/api/v1/preferences/contexts/${contextId}`, {
|
|
260
|
+
method: "PATCH",
|
|
261
|
+
body: JSON.stringify(patch)
|
|
262
|
+
});
|
|
263
|
+
}
|
|
264
|
+
export function mergePreferenceContexts(input) {
|
|
265
|
+
return request("/api/v1/preferences/contexts/merge", {
|
|
266
|
+
method: "POST",
|
|
267
|
+
body: JSON.stringify(input)
|
|
268
|
+
});
|
|
269
|
+
}
|
|
270
|
+
export function createPreferenceItem(input) {
|
|
271
|
+
return request("/api/v1/preferences/items", {
|
|
272
|
+
method: "POST",
|
|
273
|
+
body: JSON.stringify(input)
|
|
274
|
+
});
|
|
275
|
+
}
|
|
276
|
+
export function patchPreferenceItem(itemId, patch) {
|
|
277
|
+
return request(`/api/v1/preferences/items/${itemId}`, {
|
|
278
|
+
method: "PATCH",
|
|
279
|
+
body: JSON.stringify(patch)
|
|
280
|
+
});
|
|
281
|
+
}
|
|
282
|
+
export function enqueuePreferenceEntity(input) {
|
|
283
|
+
return request("/api/v1/preferences/items/from-entity", {
|
|
284
|
+
method: "POST",
|
|
285
|
+
body: JSON.stringify(input)
|
|
286
|
+
});
|
|
287
|
+
}
|
|
288
|
+
export function submitPairwisePreferenceJudgment(input) {
|
|
289
|
+
return request("/api/v1/preferences/judgments", {
|
|
290
|
+
method: "POST",
|
|
291
|
+
body: JSON.stringify(input)
|
|
292
|
+
});
|
|
293
|
+
}
|
|
294
|
+
export function submitPreferenceSignal(input) {
|
|
295
|
+
return request("/api/v1/preferences/signals", {
|
|
296
|
+
method: "POST",
|
|
297
|
+
body: JSON.stringify(input)
|
|
298
|
+
});
|
|
299
|
+
}
|
|
300
|
+
export function patchPreferenceScore(itemId, patch) {
|
|
301
|
+
return request(`/api/v1/preferences/items/${itemId}/score`, {
|
|
302
|
+
method: "PATCH",
|
|
303
|
+
body: JSON.stringify(patch)
|
|
304
|
+
});
|
|
305
|
+
}
|
|
306
|
+
export function getInsights(userIds) {
|
|
307
|
+
const search = new URLSearchParams();
|
|
308
|
+
appendUserIds(search, coerceUserIds(userIds));
|
|
309
|
+
const suffix = search.size > 0 ? `?${search.toString()}` : "";
|
|
310
|
+
return request(`/api/v1/insights${suffix}`);
|
|
311
|
+
}
|
|
312
|
+
export function listDomains() {
|
|
313
|
+
return request("/api/v1/domains");
|
|
314
|
+
}
|
|
315
|
+
export function getPsycheOverview(userIds) {
|
|
316
|
+
const search = new URLSearchParams();
|
|
317
|
+
appendUserIds(search, coerceUserIds(userIds));
|
|
318
|
+
const suffix = search.size > 0 ? `?${search.toString()}` : "";
|
|
319
|
+
return request(`/api/v1/psyche/overview${suffix}`);
|
|
320
|
+
}
|
|
321
|
+
export function listQuestionnaires(userIds) {
|
|
322
|
+
const search = new URLSearchParams();
|
|
323
|
+
appendUserIds(search, coerceUserIds(userIds));
|
|
324
|
+
const suffix = search.size > 0 ? `?${search.toString()}` : "";
|
|
325
|
+
return request(`/api/v1/psyche/questionnaires${suffix}`);
|
|
326
|
+
}
|
|
327
|
+
export function getQuestionnaire(instrumentId, userIds) {
|
|
328
|
+
const search = new URLSearchParams();
|
|
329
|
+
appendUserIds(search, coerceUserIds(userIds));
|
|
330
|
+
const suffix = search.size > 0 ? `?${search.toString()}` : "";
|
|
331
|
+
return request(`/api/v1/psyche/questionnaires/${instrumentId}${suffix}`);
|
|
332
|
+
}
|
|
333
|
+
export function createQuestionnaire(input) {
|
|
334
|
+
return request("/api/v1/psyche/questionnaires", {
|
|
335
|
+
method: "POST",
|
|
336
|
+
body: JSON.stringify(input)
|
|
337
|
+
});
|
|
338
|
+
}
|
|
339
|
+
export function cloneQuestionnaire(instrumentId, input = {}) {
|
|
340
|
+
return request(`/api/v1/psyche/questionnaires/${instrumentId}/clone`, {
|
|
341
|
+
method: "POST",
|
|
342
|
+
body: JSON.stringify(input)
|
|
343
|
+
});
|
|
344
|
+
}
|
|
345
|
+
export function ensureQuestionnaireDraft(instrumentId) {
|
|
346
|
+
return request(`/api/v1/psyche/questionnaires/${instrumentId}/draft`, {
|
|
347
|
+
method: "POST",
|
|
348
|
+
body: JSON.stringify({})
|
|
349
|
+
});
|
|
350
|
+
}
|
|
351
|
+
export function updateQuestionnaireDraft(instrumentId, input) {
|
|
352
|
+
return request(`/api/v1/psyche/questionnaires/${instrumentId}/draft`, {
|
|
353
|
+
method: "PATCH",
|
|
354
|
+
body: JSON.stringify(input)
|
|
355
|
+
});
|
|
356
|
+
}
|
|
357
|
+
export function publishQuestionnaireDraft(instrumentId, input = {}) {
|
|
358
|
+
return request(`/api/v1/psyche/questionnaires/${instrumentId}/publish`, {
|
|
359
|
+
method: "POST",
|
|
360
|
+
body: JSON.stringify(input)
|
|
361
|
+
});
|
|
362
|
+
}
|
|
363
|
+
export function startQuestionnaireRun(instrumentId, input = {}) {
|
|
364
|
+
return request(`/api/v1/psyche/questionnaires/${instrumentId}/runs`, {
|
|
365
|
+
method: "POST",
|
|
366
|
+
body: JSON.stringify(input)
|
|
367
|
+
});
|
|
368
|
+
}
|
|
369
|
+
export function getQuestionnaireRun(runId, userIds) {
|
|
370
|
+
const search = new URLSearchParams();
|
|
371
|
+
appendUserIds(search, coerceUserIds(userIds));
|
|
372
|
+
const suffix = search.size > 0 ? `?${search.toString()}` : "";
|
|
373
|
+
return request(`/api/v1/psyche/questionnaire-runs/${runId}${suffix}`);
|
|
374
|
+
}
|
|
375
|
+
export function patchQuestionnaireRun(runId, input) {
|
|
376
|
+
return request(`/api/v1/psyche/questionnaire-runs/${runId}`, {
|
|
377
|
+
method: "PATCH",
|
|
378
|
+
body: JSON.stringify(input)
|
|
379
|
+
});
|
|
380
|
+
}
|
|
381
|
+
export function completeQuestionnaireAssessment(runId) {
|
|
382
|
+
return request(`/api/v1/psyche/questionnaire-runs/${runId}/complete`, {
|
|
383
|
+
method: "POST",
|
|
384
|
+
body: JSON.stringify({})
|
|
385
|
+
});
|
|
386
|
+
}
|
|
387
|
+
export function listPsycheValues(userIds) {
|
|
388
|
+
const search = new URLSearchParams();
|
|
389
|
+
appendUserIds(search, coerceUserIds(userIds));
|
|
390
|
+
const suffix = search.size > 0 ? `?${search.toString()}` : "";
|
|
391
|
+
return request(`/api/v1/psyche/values${suffix}`);
|
|
392
|
+
}
|
|
393
|
+
export function getPsycheValue(valueId) {
|
|
394
|
+
return request(`/api/v1/psyche/values/${valueId}`);
|
|
395
|
+
}
|
|
396
|
+
export function createPsycheValue(input) {
|
|
397
|
+
return request("/api/v1/psyche/values", {
|
|
398
|
+
method: "POST",
|
|
399
|
+
body: JSON.stringify(input)
|
|
400
|
+
});
|
|
401
|
+
}
|
|
402
|
+
export function patchPsycheValue(valueId, patch) {
|
|
403
|
+
return request(`/api/v1/psyche/values/${valueId}`, {
|
|
404
|
+
method: "PATCH",
|
|
405
|
+
body: JSON.stringify(patch)
|
|
406
|
+
});
|
|
407
|
+
}
|
|
408
|
+
export function deletePsycheValue(valueId) {
|
|
409
|
+
return request(`/api/v1/psyche/values/${valueId}`, {
|
|
410
|
+
method: "DELETE"
|
|
411
|
+
});
|
|
412
|
+
}
|
|
413
|
+
export function listBehaviorPatterns(userIds) {
|
|
414
|
+
const search = new URLSearchParams();
|
|
415
|
+
appendUserIds(search, coerceUserIds(userIds));
|
|
416
|
+
const suffix = search.size > 0 ? `?${search.toString()}` : "";
|
|
417
|
+
return request(`/api/v1/psyche/patterns${suffix}`);
|
|
418
|
+
}
|
|
419
|
+
export function getBehaviorPattern(patternId) {
|
|
420
|
+
return request(`/api/v1/psyche/patterns/${patternId}`);
|
|
421
|
+
}
|
|
422
|
+
export function createBehaviorPattern(input) {
|
|
423
|
+
return request("/api/v1/psyche/patterns", {
|
|
424
|
+
method: "POST",
|
|
425
|
+
body: JSON.stringify(input)
|
|
426
|
+
});
|
|
427
|
+
}
|
|
428
|
+
export function patchBehaviorPattern(patternId, patch) {
|
|
429
|
+
return request(`/api/v1/psyche/patterns/${patternId}`, {
|
|
430
|
+
method: "PATCH",
|
|
431
|
+
body: JSON.stringify(patch)
|
|
432
|
+
});
|
|
433
|
+
}
|
|
434
|
+
export function deleteBehaviorPattern(patternId) {
|
|
435
|
+
return request(`/api/v1/psyche/patterns/${patternId}`, {
|
|
436
|
+
method: "DELETE"
|
|
437
|
+
});
|
|
438
|
+
}
|
|
439
|
+
export function listBehaviors(userIds) {
|
|
440
|
+
const search = new URLSearchParams();
|
|
441
|
+
appendUserIds(search, coerceUserIds(userIds));
|
|
442
|
+
const suffix = search.size > 0 ? `?${search.toString()}` : "";
|
|
443
|
+
return request(`/api/v1/psyche/behaviors${suffix}`);
|
|
444
|
+
}
|
|
445
|
+
export function getBehavior(behaviorId) {
|
|
446
|
+
return request(`/api/v1/psyche/behaviors/${behaviorId}`);
|
|
447
|
+
}
|
|
448
|
+
export function createBehavior(input) {
|
|
449
|
+
return request("/api/v1/psyche/behaviors", {
|
|
450
|
+
method: "POST",
|
|
451
|
+
body: JSON.stringify(input)
|
|
452
|
+
});
|
|
453
|
+
}
|
|
454
|
+
export function patchBehavior(behaviorId, patch) {
|
|
455
|
+
return request(`/api/v1/psyche/behaviors/${behaviorId}`, {
|
|
456
|
+
method: "PATCH",
|
|
457
|
+
body: JSON.stringify(patch)
|
|
458
|
+
});
|
|
459
|
+
}
|
|
460
|
+
export function deleteBehavior(behaviorId) {
|
|
461
|
+
return request(`/api/v1/psyche/behaviors/${behaviorId}`, {
|
|
462
|
+
method: "DELETE"
|
|
463
|
+
});
|
|
464
|
+
}
|
|
465
|
+
export function listSchemaCatalog() {
|
|
466
|
+
return request("/api/v1/psyche/schema-catalog");
|
|
467
|
+
}
|
|
468
|
+
export function listBeliefs(userIds) {
|
|
469
|
+
const search = new URLSearchParams();
|
|
470
|
+
appendUserIds(search, coerceUserIds(userIds));
|
|
471
|
+
const suffix = search.size > 0 ? `?${search.toString()}` : "";
|
|
472
|
+
return request(`/api/v1/psyche/beliefs${suffix}`);
|
|
473
|
+
}
|
|
474
|
+
export function getBelief(beliefId) {
|
|
475
|
+
return request(`/api/v1/psyche/beliefs/${beliefId}`);
|
|
476
|
+
}
|
|
477
|
+
export function createBelief(input) {
|
|
478
|
+
return request("/api/v1/psyche/beliefs", {
|
|
479
|
+
method: "POST",
|
|
480
|
+
body: JSON.stringify(input)
|
|
481
|
+
});
|
|
482
|
+
}
|
|
483
|
+
export function patchBelief(beliefId, patch) {
|
|
484
|
+
return request(`/api/v1/psyche/beliefs/${beliefId}`, {
|
|
485
|
+
method: "PATCH",
|
|
486
|
+
body: JSON.stringify(patch)
|
|
487
|
+
});
|
|
488
|
+
}
|
|
489
|
+
export function deleteBelief(beliefId) {
|
|
490
|
+
return request(`/api/v1/psyche/beliefs/${beliefId}`, {
|
|
491
|
+
method: "DELETE"
|
|
492
|
+
});
|
|
493
|
+
}
|
|
494
|
+
export function listModes(userIds) {
|
|
495
|
+
const search = new URLSearchParams();
|
|
496
|
+
appendUserIds(search, coerceUserIds(userIds));
|
|
497
|
+
const suffix = search.size > 0 ? `?${search.toString()}` : "";
|
|
498
|
+
return request(`/api/v1/psyche/modes${suffix}`);
|
|
499
|
+
}
|
|
500
|
+
export function getMode(modeId) {
|
|
501
|
+
return request(`/api/v1/psyche/modes/${modeId}`);
|
|
502
|
+
}
|
|
503
|
+
export function createMode(input) {
|
|
504
|
+
return request("/api/v1/psyche/modes", {
|
|
505
|
+
method: "POST",
|
|
506
|
+
body: JSON.stringify(input)
|
|
507
|
+
});
|
|
508
|
+
}
|
|
509
|
+
export function patchMode(modeId, patch) {
|
|
510
|
+
return request(`/api/v1/psyche/modes/${modeId}`, {
|
|
511
|
+
method: "PATCH",
|
|
512
|
+
body: JSON.stringify(patch)
|
|
513
|
+
});
|
|
514
|
+
}
|
|
515
|
+
export function deleteMode(modeId) {
|
|
516
|
+
return request(`/api/v1/psyche/modes/${modeId}`, {
|
|
517
|
+
method: "DELETE"
|
|
518
|
+
});
|
|
519
|
+
}
|
|
520
|
+
export function listModeGuideSessions() {
|
|
521
|
+
return request("/api/v1/psyche/mode-guides");
|
|
522
|
+
}
|
|
523
|
+
export function getModeGuideSession(sessionId) {
|
|
524
|
+
return request(`/api/v1/psyche/mode-guides/${sessionId}`);
|
|
525
|
+
}
|
|
526
|
+
export function createModeGuideSession(input) {
|
|
527
|
+
return request("/api/v1/psyche/mode-guides", {
|
|
528
|
+
method: "POST",
|
|
529
|
+
body: JSON.stringify(input)
|
|
530
|
+
});
|
|
531
|
+
}
|
|
532
|
+
export function patchModeGuideSession(sessionId, patch) {
|
|
533
|
+
return request(`/api/v1/psyche/mode-guides/${sessionId}`, {
|
|
534
|
+
method: "PATCH",
|
|
535
|
+
body: JSON.stringify(patch)
|
|
536
|
+
});
|
|
537
|
+
}
|
|
538
|
+
export function deleteModeGuideSession(sessionId) {
|
|
539
|
+
return request(`/api/v1/psyche/mode-guides/${sessionId}`, {
|
|
540
|
+
method: "DELETE"
|
|
541
|
+
});
|
|
542
|
+
}
|
|
543
|
+
export function listEventTypes() {
|
|
544
|
+
return request("/api/v1/psyche/event-types");
|
|
545
|
+
}
|
|
546
|
+
export function getEventType(eventTypeId) {
|
|
547
|
+
return request(`/api/v1/psyche/event-types/${eventTypeId}`);
|
|
548
|
+
}
|
|
549
|
+
export function createEventType(input) {
|
|
550
|
+
return request("/api/v1/psyche/event-types", {
|
|
551
|
+
method: "POST",
|
|
552
|
+
body: JSON.stringify(input)
|
|
553
|
+
});
|
|
554
|
+
}
|
|
555
|
+
export function patchEventType(eventTypeId, patch) {
|
|
556
|
+
return request(`/api/v1/psyche/event-types/${eventTypeId}`, {
|
|
557
|
+
method: "PATCH",
|
|
558
|
+
body: JSON.stringify(patch)
|
|
559
|
+
});
|
|
560
|
+
}
|
|
561
|
+
export function deleteEventType(eventTypeId) {
|
|
562
|
+
return request(`/api/v1/psyche/event-types/${eventTypeId}`, {
|
|
563
|
+
method: "DELETE"
|
|
564
|
+
});
|
|
565
|
+
}
|
|
566
|
+
export function listEmotionDefinitions() {
|
|
567
|
+
return request("/api/v1/psyche/emotions");
|
|
568
|
+
}
|
|
569
|
+
export function getEmotionDefinition(emotionId) {
|
|
570
|
+
return request(`/api/v1/psyche/emotions/${emotionId}`);
|
|
571
|
+
}
|
|
572
|
+
export function createEmotionDefinition(input) {
|
|
573
|
+
return request("/api/v1/psyche/emotions", {
|
|
574
|
+
method: "POST",
|
|
575
|
+
body: JSON.stringify(input)
|
|
576
|
+
});
|
|
577
|
+
}
|
|
578
|
+
export function patchEmotionDefinition(emotionId, patch) {
|
|
579
|
+
return request(`/api/v1/psyche/emotions/${emotionId}`, {
|
|
580
|
+
method: "PATCH",
|
|
581
|
+
body: JSON.stringify(patch)
|
|
582
|
+
});
|
|
583
|
+
}
|
|
584
|
+
export function deleteEmotionDefinition(emotionId) {
|
|
585
|
+
return request(`/api/v1/psyche/emotions/${emotionId}`, {
|
|
586
|
+
method: "DELETE"
|
|
587
|
+
});
|
|
588
|
+
}
|
|
589
|
+
export function listTriggerReports(userIds) {
|
|
590
|
+
const search = new URLSearchParams();
|
|
591
|
+
appendUserIds(search, coerceUserIds(userIds));
|
|
592
|
+
const suffix = search.size > 0 ? `?${search.toString()}` : "";
|
|
593
|
+
return request(`/api/v1/psyche/reports${suffix}`);
|
|
594
|
+
}
|
|
595
|
+
export function createTriggerReport(input) {
|
|
596
|
+
return request("/api/v1/psyche/reports", {
|
|
597
|
+
method: "POST",
|
|
598
|
+
body: JSON.stringify(input)
|
|
599
|
+
});
|
|
600
|
+
}
|
|
601
|
+
export function getTriggerReport(reportId) {
|
|
602
|
+
return request(`/api/v1/psyche/reports/${reportId}`);
|
|
603
|
+
}
|
|
604
|
+
export function patchTriggerReport(reportId, patch) {
|
|
605
|
+
return request(`/api/v1/psyche/reports/${reportId}`, {
|
|
606
|
+
method: "PATCH",
|
|
607
|
+
body: JSON.stringify(patch)
|
|
608
|
+
});
|
|
609
|
+
}
|
|
610
|
+
export function deleteTriggerReport(reportId) {
|
|
611
|
+
return request(`/api/v1/psyche/reports/${reportId}`, {
|
|
612
|
+
method: "DELETE"
|
|
613
|
+
});
|
|
614
|
+
}
|
|
615
|
+
export function listNotes(input = {}) {
|
|
616
|
+
const search = new URLSearchParams();
|
|
617
|
+
if (input.linkedEntityType) {
|
|
618
|
+
search.set("linkedEntityType", input.linkedEntityType);
|
|
619
|
+
}
|
|
620
|
+
if (input.linkedEntityId) {
|
|
621
|
+
search.set("linkedEntityId", input.linkedEntityId);
|
|
622
|
+
}
|
|
623
|
+
if (input.anchorKey !== undefined && input.anchorKey !== null) {
|
|
624
|
+
search.set("anchorKey", input.anchorKey);
|
|
625
|
+
}
|
|
626
|
+
for (const link of input.linkedTo ?? []) {
|
|
627
|
+
search.append("linkedTo", `${link.entityType}:${link.entityId}`);
|
|
628
|
+
}
|
|
629
|
+
for (const tag of input.tags ?? []) {
|
|
630
|
+
if (tag.trim()) {
|
|
631
|
+
search.append("tags", tag.trim());
|
|
632
|
+
}
|
|
633
|
+
}
|
|
634
|
+
for (const term of input.textTerms ?? []) {
|
|
635
|
+
if (term.trim()) {
|
|
636
|
+
search.append("textTerms", term.trim());
|
|
637
|
+
}
|
|
638
|
+
}
|
|
639
|
+
if (input.author) {
|
|
640
|
+
search.set("author", input.author);
|
|
641
|
+
}
|
|
642
|
+
if (input.query) {
|
|
643
|
+
search.set("query", input.query);
|
|
644
|
+
}
|
|
645
|
+
appendUserIds(search, input.userIds);
|
|
646
|
+
if (input.updatedFrom) {
|
|
647
|
+
search.set("updatedFrom", input.updatedFrom);
|
|
648
|
+
}
|
|
649
|
+
if (input.updatedTo) {
|
|
650
|
+
search.set("updatedTo", input.updatedTo);
|
|
651
|
+
}
|
|
652
|
+
if (input.limit) {
|
|
653
|
+
search.set("limit", String(input.limit));
|
|
654
|
+
}
|
|
655
|
+
const suffix = search.size > 0 ? `?${search.toString()}` : "";
|
|
656
|
+
return request(`/api/v1/notes${suffix}`);
|
|
657
|
+
}
|
|
658
|
+
export function createNote(input) {
|
|
659
|
+
return request("/api/v1/notes", {
|
|
660
|
+
method: "POST",
|
|
661
|
+
body: JSON.stringify(input)
|
|
662
|
+
});
|
|
663
|
+
}
|
|
664
|
+
export function getNote(noteId) {
|
|
665
|
+
return request(`/api/v1/notes/${noteId}`);
|
|
666
|
+
}
|
|
667
|
+
export function patchNote(noteId, patch) {
|
|
668
|
+
return request(`/api/v1/notes/${noteId}`, {
|
|
669
|
+
method: "PATCH",
|
|
670
|
+
body: JSON.stringify(patch)
|
|
671
|
+
});
|
|
672
|
+
}
|
|
673
|
+
export function deleteNote(noteId, mode = "soft") {
|
|
674
|
+
const suffix = mode === "soft" ? "" : `?mode=${mode}`;
|
|
675
|
+
return request(`/api/v1/notes/${noteId}${suffix}`, {
|
|
676
|
+
method: "DELETE"
|
|
677
|
+
});
|
|
678
|
+
}
|
|
679
|
+
export function getWikiSettings() {
|
|
680
|
+
return request("/api/v1/wiki/settings");
|
|
681
|
+
}
|
|
682
|
+
export function createWikiSpace(input) {
|
|
683
|
+
return request("/api/v1/wiki/spaces", {
|
|
684
|
+
method: "POST",
|
|
685
|
+
body: JSON.stringify(input)
|
|
686
|
+
});
|
|
687
|
+
}
|
|
688
|
+
export function listWikiSpaces() {
|
|
689
|
+
return request("/api/v1/wiki/spaces");
|
|
690
|
+
}
|
|
691
|
+
export function listWikiPages(input = {}) {
|
|
692
|
+
const search = new URLSearchParams();
|
|
693
|
+
if (input.spaceId) {
|
|
694
|
+
search.set("spaceId", input.spaceId);
|
|
695
|
+
}
|
|
696
|
+
if (input.kind) {
|
|
697
|
+
search.set("kind", input.kind);
|
|
698
|
+
}
|
|
699
|
+
if (input.limit) {
|
|
700
|
+
search.set("limit", String(input.limit));
|
|
701
|
+
}
|
|
702
|
+
const suffix = search.size > 0 ? `?${search.toString()}` : "";
|
|
703
|
+
return request(`/api/v1/wiki/pages${suffix}`);
|
|
704
|
+
}
|
|
705
|
+
export function getWikiPage(pageId) {
|
|
706
|
+
return request(`/api/v1/wiki/pages/${pageId}`);
|
|
707
|
+
}
|
|
708
|
+
export function getWikiHome(input = {}) {
|
|
709
|
+
const search = new URLSearchParams();
|
|
710
|
+
if (input.spaceId?.trim()) {
|
|
711
|
+
search.set("spaceId", input.spaceId.trim());
|
|
712
|
+
}
|
|
713
|
+
return request(`/api/v1/wiki/home${search.size > 0 ? `?${search.toString()}` : ""}`);
|
|
714
|
+
}
|
|
715
|
+
export function getWikiPageBySlug(input) {
|
|
716
|
+
const search = new URLSearchParams();
|
|
717
|
+
if (input.spaceId?.trim()) {
|
|
718
|
+
search.set("spaceId", input.spaceId.trim());
|
|
719
|
+
}
|
|
720
|
+
return request(`/api/v1/wiki/by-slug/${encodeURIComponent(input.slug)}${search.size > 0 ? `?${search.toString()}` : ""}`);
|
|
721
|
+
}
|
|
722
|
+
export function getWikiTree(input = {}) {
|
|
723
|
+
const search = new URLSearchParams();
|
|
724
|
+
if (input.spaceId?.trim()) {
|
|
725
|
+
search.set("spaceId", input.spaceId.trim());
|
|
726
|
+
}
|
|
727
|
+
if (input.kind) {
|
|
728
|
+
search.set("kind", input.kind);
|
|
729
|
+
}
|
|
730
|
+
return request(`/api/v1/wiki/tree${search.size > 0 ? `?${search.toString()}` : ""}`);
|
|
731
|
+
}
|
|
732
|
+
export function createWikiPage(input) {
|
|
733
|
+
return request("/api/v1/wiki/pages", {
|
|
734
|
+
method: "POST",
|
|
735
|
+
body: JSON.stringify({
|
|
736
|
+
kind: input.kind ?? "wiki",
|
|
737
|
+
title: input.title,
|
|
738
|
+
slug: input.slug ?? "",
|
|
739
|
+
parentSlug: input.parentSlug ?? null,
|
|
740
|
+
indexOrder: input.indexOrder ?? 0,
|
|
741
|
+
showInIndex: input.showInIndex ?? true,
|
|
742
|
+
aliases: input.aliases ?? [],
|
|
743
|
+
summary: input.summary ?? "",
|
|
744
|
+
contentMarkdown: input.contentMarkdown,
|
|
745
|
+
author: input.author ?? null,
|
|
746
|
+
tags: input.tags ?? [],
|
|
747
|
+
spaceId: input.spaceId ?? "",
|
|
748
|
+
frontmatter: input.frontmatter ?? {},
|
|
749
|
+
links: input.links ?? []
|
|
750
|
+
})
|
|
751
|
+
});
|
|
752
|
+
}
|
|
753
|
+
export function patchWikiPage(pageId, patch) {
|
|
754
|
+
return request(`/api/v1/wiki/pages/${pageId}`, {
|
|
755
|
+
method: "PATCH",
|
|
756
|
+
body: JSON.stringify(patch)
|
|
757
|
+
});
|
|
758
|
+
}
|
|
759
|
+
export function deleteWikiPage(pageId, mode = "soft") {
|
|
760
|
+
const search = new URLSearchParams();
|
|
761
|
+
search.set("mode", mode);
|
|
762
|
+
return request(`/api/v1/wiki/pages/${pageId}?${search.toString()}`, {
|
|
763
|
+
method: "DELETE"
|
|
764
|
+
});
|
|
765
|
+
}
|
|
766
|
+
export function searchWiki(input) {
|
|
767
|
+
return request("/api/v1/wiki/search", {
|
|
768
|
+
method: "POST",
|
|
769
|
+
body: JSON.stringify(input)
|
|
770
|
+
});
|
|
771
|
+
}
|
|
772
|
+
export function getWikiHealth(input = {}) {
|
|
773
|
+
const search = new URLSearchParams();
|
|
774
|
+
if (input.spaceId?.trim()) {
|
|
775
|
+
search.set("spaceId", input.spaceId.trim());
|
|
776
|
+
}
|
|
777
|
+
return request(`/api/v1/wiki/health${search.size > 0 ? `?${search.toString()}` : ""}`);
|
|
778
|
+
}
|
|
779
|
+
export function syncWikiVault(input = {}) {
|
|
780
|
+
return request("/api/v1/wiki/sync", {
|
|
781
|
+
method: "POST",
|
|
782
|
+
body: JSON.stringify(input)
|
|
783
|
+
});
|
|
784
|
+
}
|
|
785
|
+
export function reindexWiki(input = {}) {
|
|
786
|
+
return request("/api/v1/wiki/reindex", {
|
|
787
|
+
method: "POST",
|
|
788
|
+
body: JSON.stringify(input)
|
|
789
|
+
});
|
|
790
|
+
}
|
|
791
|
+
export function createWikiLlmProfile(input) {
|
|
792
|
+
return request("/api/v1/wiki/settings/llm-profiles", {
|
|
793
|
+
method: "POST",
|
|
794
|
+
body: JSON.stringify(input)
|
|
795
|
+
});
|
|
796
|
+
}
|
|
797
|
+
export function testWikiLlmProfile(input) {
|
|
798
|
+
return request("/api/v1/wiki/settings/llm-profiles/test", {
|
|
799
|
+
method: "POST",
|
|
800
|
+
body: JSON.stringify(input)
|
|
801
|
+
});
|
|
802
|
+
}
|
|
803
|
+
export function createWikiEmbeddingProfile(input) {
|
|
804
|
+
return request("/api/v1/wiki/settings/embedding-profiles", {
|
|
805
|
+
method: "POST",
|
|
806
|
+
body: JSON.stringify(input)
|
|
807
|
+
});
|
|
808
|
+
}
|
|
809
|
+
export function deleteWikiProfile(kind, profileId) {
|
|
810
|
+
return request(`/api/v1/wiki/settings/${kind}-profiles/${profileId}`, {
|
|
811
|
+
method: "DELETE"
|
|
812
|
+
});
|
|
813
|
+
}
|
|
814
|
+
export function createWikiIngestJob(input) {
|
|
815
|
+
return request("/api/v1/wiki/ingest-jobs", {
|
|
816
|
+
method: "POST",
|
|
817
|
+
body: JSON.stringify(input)
|
|
818
|
+
});
|
|
819
|
+
}
|
|
820
|
+
export function createWikiIngestUploadJob(input) {
|
|
821
|
+
const formData = new FormData();
|
|
822
|
+
if (input.spaceId?.trim()) {
|
|
823
|
+
formData.set("spaceId", input.spaceId.trim());
|
|
824
|
+
}
|
|
825
|
+
if (input.titleHint?.trim()) {
|
|
826
|
+
formData.set("titleHint", input.titleHint.trim());
|
|
827
|
+
}
|
|
828
|
+
if (input.llmProfileId?.trim()) {
|
|
829
|
+
formData.set("llmProfileId", input.llmProfileId.trim());
|
|
830
|
+
}
|
|
831
|
+
formData.set("parseStrategy", input.parseStrategy ?? "auto");
|
|
832
|
+
formData.set("entityProposalMode", input.entityProposalMode ?? "suggest");
|
|
833
|
+
formData.set("createAsKind", input.createAsKind ?? "wiki");
|
|
834
|
+
formData.set("linkedEntityHints", JSON.stringify(input.linkedEntityHints ?? []));
|
|
835
|
+
input.files.forEach((file) => {
|
|
836
|
+
formData.append("files", file);
|
|
837
|
+
});
|
|
838
|
+
return request("/api/v1/wiki/ingest-jobs/uploads", {
|
|
839
|
+
method: "POST",
|
|
840
|
+
body: formData
|
|
841
|
+
});
|
|
842
|
+
}
|
|
843
|
+
export function listWikiIngestJobs(input = {}) {
|
|
844
|
+
const search = new URLSearchParams();
|
|
845
|
+
if (input.spaceId?.trim()) {
|
|
846
|
+
search.set("spaceId", input.spaceId.trim());
|
|
847
|
+
}
|
|
848
|
+
if (typeof input.limit === "number") {
|
|
849
|
+
search.set("limit", String(input.limit));
|
|
850
|
+
}
|
|
851
|
+
return request(`/api/v1/wiki/ingest-jobs${search.size > 0 ? `?${search.toString()}` : ""}`);
|
|
852
|
+
}
|
|
853
|
+
export function getWikiIngestJob(jobId) {
|
|
854
|
+
return request(`/api/v1/wiki/ingest-jobs/${jobId}`);
|
|
855
|
+
}
|
|
856
|
+
export function searchWikiPages(input) {
|
|
857
|
+
return request("/api/v1/wiki/search", {
|
|
858
|
+
method: "POST",
|
|
859
|
+
body: JSON.stringify({
|
|
860
|
+
spaceId: input.spaceId,
|
|
861
|
+
kind: input.kind,
|
|
862
|
+
mode: input.mode ?? "text",
|
|
863
|
+
query: input.query ?? "",
|
|
864
|
+
profileId: input.profileId,
|
|
865
|
+
limit: input.limit ?? 8
|
|
866
|
+
})
|
|
867
|
+
});
|
|
868
|
+
}
|
|
869
|
+
export function deleteWikiIngestJob(jobId) {
|
|
870
|
+
return request(`/api/v1/wiki/ingest-jobs/${jobId}`, {
|
|
871
|
+
method: "DELETE"
|
|
872
|
+
});
|
|
873
|
+
}
|
|
874
|
+
export function rerunWikiIngestJob(jobId) {
|
|
875
|
+
return request(`/api/v1/wiki/ingest-jobs/${jobId}/rerun`, {
|
|
876
|
+
method: "POST"
|
|
877
|
+
});
|
|
878
|
+
}
|
|
879
|
+
export function resumeWikiIngestJob(jobId) {
|
|
880
|
+
return request(`/api/v1/wiki/ingest-jobs/${jobId}/resume`, {
|
|
881
|
+
method: "POST"
|
|
882
|
+
});
|
|
883
|
+
}
|
|
884
|
+
export function reviewWikiIngestJob(input) {
|
|
885
|
+
return request(`/api/v1/wiki/ingest-jobs/${input.jobId}/review`, {
|
|
886
|
+
method: "POST",
|
|
887
|
+
body: JSON.stringify({
|
|
888
|
+
decisions: input.decisions
|
|
889
|
+
})
|
|
890
|
+
});
|
|
891
|
+
}
|
|
892
|
+
export function createInsight(input) {
|
|
893
|
+
return request("/api/v1/insights", {
|
|
894
|
+
method: "POST",
|
|
895
|
+
body: JSON.stringify({
|
|
896
|
+
...input,
|
|
897
|
+
originAgentId: input.originAgentId || null,
|
|
898
|
+
originLabel: input.originLabel || null,
|
|
899
|
+
entityType: input.entityType || null,
|
|
900
|
+
entityId: input.entityId || null,
|
|
901
|
+
timeframeLabel: input.timeframeLabel || null,
|
|
902
|
+
visibility: "visible",
|
|
903
|
+
status: "open",
|
|
904
|
+
evidence: []
|
|
905
|
+
})
|
|
906
|
+
});
|
|
907
|
+
}
|
|
908
|
+
export function patchInsight(insightId, patch) {
|
|
909
|
+
return request(`/api/v1/insights/${insightId}`, {
|
|
910
|
+
method: "PATCH",
|
|
911
|
+
body: JSON.stringify(patch)
|
|
912
|
+
});
|
|
913
|
+
}
|
|
914
|
+
export function deleteInsight(insightId) {
|
|
915
|
+
return request(`/api/v1/insights/${insightId}`, {
|
|
916
|
+
method: "DELETE"
|
|
917
|
+
});
|
|
918
|
+
}
|
|
919
|
+
export function submitInsightFeedback(insightId, feedbackType, note = "") {
|
|
920
|
+
return request(`/api/v1/insights/${insightId}/feedback`, {
|
|
921
|
+
method: "POST",
|
|
922
|
+
body: JSON.stringify({ feedbackType, note })
|
|
923
|
+
});
|
|
924
|
+
}
|
|
925
|
+
export function getWeeklyReview() {
|
|
926
|
+
return request("/api/v1/reviews/weekly");
|
|
927
|
+
}
|
|
928
|
+
export function finalizeWeeklyReview() {
|
|
929
|
+
return request("/api/v1/reviews/weekly/finalize", {
|
|
930
|
+
method: "POST"
|
|
931
|
+
});
|
|
932
|
+
}
|
|
933
|
+
export function getCalendarOverview(input = {}) {
|
|
934
|
+
const search = new URLSearchParams();
|
|
935
|
+
if (input.from) {
|
|
936
|
+
search.set("from", input.from);
|
|
937
|
+
}
|
|
938
|
+
if (input.to) {
|
|
939
|
+
search.set("to", input.to);
|
|
940
|
+
}
|
|
941
|
+
appendUserIds(search, coerceUserIds(input.userIds));
|
|
942
|
+
const suffix = search.size > 0 ? `?${search.toString()}` : "";
|
|
943
|
+
return request(`/api/v1/calendar/overview${suffix}`).then((response) => ({
|
|
944
|
+
...response,
|
|
945
|
+
calendar: normalizeCalendarOverviewPayload(response.calendar)
|
|
946
|
+
}));
|
|
947
|
+
}
|
|
948
|
+
export function getPsycheObservationCalendar(input = {}) {
|
|
949
|
+
const search = new URLSearchParams();
|
|
950
|
+
if (input.from) {
|
|
951
|
+
search.set("from", input.from);
|
|
952
|
+
}
|
|
953
|
+
if (input.to) {
|
|
954
|
+
search.set("to", input.to);
|
|
955
|
+
}
|
|
956
|
+
appendUserIds(search, coerceUserIds(input.userIds));
|
|
957
|
+
const suffix = search.size > 0 ? `?${search.toString()}` : "";
|
|
958
|
+
return request(`/api/v1/psyche/self-observation/calendar${suffix}`);
|
|
959
|
+
}
|
|
960
|
+
export function listCalendarConnections() {
|
|
961
|
+
return request("/api/v1/calendar/connections");
|
|
962
|
+
}
|
|
963
|
+
export function discoverCalendarConnection(input) {
|
|
964
|
+
return request("/api/v1/calendar/discovery", {
|
|
965
|
+
method: "POST",
|
|
966
|
+
body: JSON.stringify(input)
|
|
967
|
+
}).then((response) => ({
|
|
968
|
+
...response,
|
|
969
|
+
discovery: dedupeCalendarDiscoveryPayload(response.discovery)
|
|
970
|
+
}));
|
|
971
|
+
}
|
|
972
|
+
export function startGoogleCalendarOauth(input) {
|
|
973
|
+
return request("/api/v1/calendar/oauth/google/start", {
|
|
974
|
+
method: "POST",
|
|
975
|
+
body: JSON.stringify(input)
|
|
976
|
+
});
|
|
977
|
+
}
|
|
978
|
+
export function getGoogleCalendarOauthSession(sessionId) {
|
|
979
|
+
return request(`/api/v1/calendar/oauth/google/session/${sessionId}`).then((response) => ({
|
|
980
|
+
...response,
|
|
981
|
+
session: {
|
|
982
|
+
...response.session,
|
|
983
|
+
discovery: response.session.discovery
|
|
984
|
+
? dedupeCalendarDiscoveryPayload(response.session.discovery)
|
|
985
|
+
: null
|
|
986
|
+
}
|
|
987
|
+
}));
|
|
988
|
+
}
|
|
989
|
+
export function startMicrosoftCalendarOauth(input) {
|
|
990
|
+
return request("/api/v1/calendar/oauth/microsoft/start", {
|
|
991
|
+
method: "POST",
|
|
992
|
+
body: JSON.stringify(input)
|
|
993
|
+
});
|
|
994
|
+
}
|
|
995
|
+
export function testMicrosoftCalendarOauthConfiguration(input) {
|
|
996
|
+
return request("/api/v1/calendar/oauth/microsoft/test-config", {
|
|
997
|
+
method: "POST",
|
|
998
|
+
body: JSON.stringify(input)
|
|
999
|
+
});
|
|
1000
|
+
}
|
|
1001
|
+
export function getMicrosoftCalendarOauthSession(sessionId) {
|
|
1002
|
+
return request(`/api/v1/calendar/oauth/microsoft/session/${sessionId}`).then((response) => ({
|
|
1003
|
+
...response,
|
|
1004
|
+
session: {
|
|
1005
|
+
...response.session,
|
|
1006
|
+
discovery: response.session.discovery
|
|
1007
|
+
? dedupeCalendarDiscoveryPayload(response.session.discovery)
|
|
1008
|
+
: null
|
|
1009
|
+
}
|
|
1010
|
+
}));
|
|
1011
|
+
}
|
|
1012
|
+
export function discoverExistingCalendarConnection(connectionId) {
|
|
1013
|
+
return request(`/api/v1/calendar/connections/${connectionId}/discovery`).then((response) => ({
|
|
1014
|
+
...response,
|
|
1015
|
+
discovery: dedupeCalendarDiscoveryPayload(response.discovery)
|
|
1016
|
+
}));
|
|
1017
|
+
}
|
|
1018
|
+
export function createCalendarConnection(input) {
|
|
1019
|
+
return request("/api/v1/calendar/connections", {
|
|
1020
|
+
method: "POST",
|
|
1021
|
+
body: JSON.stringify(input)
|
|
1022
|
+
});
|
|
1023
|
+
}
|
|
1024
|
+
export function syncCalendarConnection(connectionId) {
|
|
1025
|
+
return request(`/api/v1/calendar/connections/${connectionId}/sync`, {
|
|
1026
|
+
method: "POST"
|
|
1027
|
+
});
|
|
1028
|
+
}
|
|
1029
|
+
export function patchCalendarConnection(connectionId, patch) {
|
|
1030
|
+
return request(`/api/v1/calendar/connections/${connectionId}`, {
|
|
1031
|
+
method: "PATCH",
|
|
1032
|
+
body: JSON.stringify(patch)
|
|
1033
|
+
});
|
|
1034
|
+
}
|
|
1035
|
+
export function deleteCalendarConnection(connectionId) {
|
|
1036
|
+
return request(`/api/v1/calendar/connections/${connectionId}`, {
|
|
1037
|
+
method: "DELETE"
|
|
1038
|
+
});
|
|
1039
|
+
}
|
|
1040
|
+
export function listCalendarResources() {
|
|
1041
|
+
return request("/api/v1/calendar/calendars");
|
|
1042
|
+
}
|
|
1043
|
+
export function listWorkBlockTemplates() {
|
|
1044
|
+
return request("/api/v1/calendar/work-block-templates");
|
|
1045
|
+
}
|
|
1046
|
+
export function createWorkBlockTemplate(input) {
|
|
1047
|
+
return request("/api/v1/calendar/work-block-templates", {
|
|
1048
|
+
method: "POST",
|
|
1049
|
+
body: JSON.stringify(input)
|
|
1050
|
+
});
|
|
1051
|
+
}
|
|
1052
|
+
export function patchWorkBlockTemplate(templateId, patch) {
|
|
1053
|
+
return request(`/api/v1/calendar/work-block-templates/${templateId}`, {
|
|
1054
|
+
method: "PATCH",
|
|
1055
|
+
body: JSON.stringify(patch)
|
|
1056
|
+
});
|
|
1057
|
+
}
|
|
1058
|
+
export function deleteWorkBlockTemplate(templateId) {
|
|
1059
|
+
return request(`/api/v1/calendar/work-block-templates/${templateId}`, {
|
|
1060
|
+
method: "DELETE"
|
|
1061
|
+
});
|
|
1062
|
+
}
|
|
1063
|
+
export function listTaskTimeboxes(input = {}) {
|
|
1064
|
+
const search = new URLSearchParams();
|
|
1065
|
+
if (input.from) {
|
|
1066
|
+
search.set("from", input.from);
|
|
1067
|
+
}
|
|
1068
|
+
if (input.to) {
|
|
1069
|
+
search.set("to", input.to);
|
|
1070
|
+
}
|
|
1071
|
+
appendUserIds(search, coerceUserIds(input.userIds));
|
|
1072
|
+
const suffix = search.size > 0 ? `?${search.toString()}` : "";
|
|
1073
|
+
return request(`/api/v1/calendar/timeboxes${suffix}`);
|
|
1074
|
+
}
|
|
1075
|
+
export function createCalendarEvent(input) {
|
|
1076
|
+
return request("/api/v1/calendar/events", {
|
|
1077
|
+
method: "POST",
|
|
1078
|
+
body: JSON.stringify(input)
|
|
1079
|
+
}).then((response) => ({
|
|
1080
|
+
...response,
|
|
1081
|
+
event: normalizeCalendarEventPlace(response.event)
|
|
1082
|
+
}));
|
|
1083
|
+
}
|
|
1084
|
+
export function patchCalendarEvent(eventId, patch) {
|
|
1085
|
+
return request(`/api/v1/calendar/events/${eventId}`, {
|
|
1086
|
+
method: "PATCH",
|
|
1087
|
+
body: JSON.stringify(patch)
|
|
1088
|
+
}).then((response) => ({
|
|
1089
|
+
...response,
|
|
1090
|
+
event: normalizeCalendarEventPlace(response.event)
|
|
1091
|
+
}));
|
|
1092
|
+
}
|
|
1093
|
+
export function deleteCalendarEvent(eventId) {
|
|
1094
|
+
return request(`/api/v1/calendar/events/${eventId}`, {
|
|
1095
|
+
method: "DELETE"
|
|
1096
|
+
});
|
|
1097
|
+
}
|
|
1098
|
+
export function createTaskTimebox(input) {
|
|
1099
|
+
return request("/api/v1/calendar/timeboxes", {
|
|
1100
|
+
method: "POST",
|
|
1101
|
+
body: JSON.stringify(input)
|
|
1102
|
+
});
|
|
1103
|
+
}
|
|
1104
|
+
export function patchTaskTimebox(timeboxId, patch) {
|
|
1105
|
+
return request(`/api/v1/calendar/timeboxes/${timeboxId}`, {
|
|
1106
|
+
method: "PATCH",
|
|
1107
|
+
body: JSON.stringify(patch)
|
|
1108
|
+
});
|
|
1109
|
+
}
|
|
1110
|
+
export function deleteTaskTimebox(timeboxId) {
|
|
1111
|
+
return request(`/api/v1/calendar/timeboxes/${timeboxId}`, {
|
|
1112
|
+
method: "DELETE"
|
|
1113
|
+
});
|
|
1114
|
+
}
|
|
1115
|
+
export function recommendTaskTimeboxes(input) {
|
|
1116
|
+
return request("/api/v1/calendar/timeboxes/recommend", {
|
|
1117
|
+
method: "POST",
|
|
1118
|
+
body: JSON.stringify(input)
|
|
1119
|
+
});
|
|
1120
|
+
}
|
|
1121
|
+
export function listProjects(userIds) {
|
|
1122
|
+
const search = new URLSearchParams();
|
|
1123
|
+
appendUserIds(search, userIds);
|
|
1124
|
+
const suffix = search.size > 0 ? `?${search.toString()}` : "";
|
|
1125
|
+
return request(`/api/v1/projects${suffix}`);
|
|
1126
|
+
}
|
|
1127
|
+
export function listHabits(input = {}) {
|
|
1128
|
+
const search = new URLSearchParams();
|
|
1129
|
+
appendUserIds(search, input.userIds);
|
|
1130
|
+
if (input.status) {
|
|
1131
|
+
search.set("status", input.status);
|
|
1132
|
+
}
|
|
1133
|
+
if (input.polarity) {
|
|
1134
|
+
search.set("polarity", input.polarity);
|
|
1135
|
+
}
|
|
1136
|
+
if (input.dueToday) {
|
|
1137
|
+
search.set("dueToday", "true");
|
|
1138
|
+
}
|
|
1139
|
+
if (input.limit) {
|
|
1140
|
+
search.set("limit", String(input.limit));
|
|
1141
|
+
}
|
|
1142
|
+
const suffix = search.size > 0 ? `?${search.toString()}` : "";
|
|
1143
|
+
return request(`/api/v1/habits${suffix}`);
|
|
1144
|
+
}
|
|
1145
|
+
export function createHabit(input) {
|
|
1146
|
+
return request("/api/v1/habits", {
|
|
1147
|
+
method: "POST",
|
|
1148
|
+
body: JSON.stringify({
|
|
1149
|
+
...input,
|
|
1150
|
+
linkedBehaviorId: input.linkedBehaviorId || null
|
|
1151
|
+
})
|
|
1152
|
+
});
|
|
1153
|
+
}
|
|
1154
|
+
export function patchHabit(habitId, patch) {
|
|
1155
|
+
return request(`/api/v1/habits/${habitId}`, {
|
|
1156
|
+
method: "PATCH",
|
|
1157
|
+
body: JSON.stringify({
|
|
1158
|
+
...patch,
|
|
1159
|
+
linkedBehaviorId: patch.linkedBehaviorId === "" ? null : patch.linkedBehaviorId
|
|
1160
|
+
})
|
|
1161
|
+
});
|
|
1162
|
+
}
|
|
1163
|
+
export function deleteHabit(habitId) {
|
|
1164
|
+
return request(`/api/v1/habits/${habitId}`, {
|
|
1165
|
+
method: "DELETE"
|
|
1166
|
+
});
|
|
1167
|
+
}
|
|
1168
|
+
export function createHabitCheckIn(habitId, input) {
|
|
1169
|
+
return request(`/api/v1/habits/${habitId}/check-ins`, {
|
|
1170
|
+
method: "POST",
|
|
1171
|
+
body: JSON.stringify(input)
|
|
1172
|
+
});
|
|
1173
|
+
}
|
|
1174
|
+
export function deleteHabitCheckIn(habitId, dateKey) {
|
|
1175
|
+
return request(`/api/v1/habits/${habitId}/check-ins/${encodeURIComponent(dateKey)}`, {
|
|
1176
|
+
method: "DELETE"
|
|
1177
|
+
});
|
|
1178
|
+
}
|
|
1179
|
+
export function listTags() {
|
|
1180
|
+
return request("/api/v1/tags");
|
|
1181
|
+
}
|
|
1182
|
+
export function getTag(tagId) {
|
|
1183
|
+
return request(`/api/v1/tags/${tagId}`);
|
|
1184
|
+
}
|
|
1185
|
+
export function createTag(input) {
|
|
1186
|
+
return request("/api/v1/tags", {
|
|
1187
|
+
method: "POST",
|
|
1188
|
+
body: JSON.stringify(input)
|
|
1189
|
+
});
|
|
1190
|
+
}
|
|
1191
|
+
export function patchTag(tagId, patch) {
|
|
1192
|
+
return request(`/api/v1/tags/${tagId}`, {
|
|
1193
|
+
method: "PATCH",
|
|
1194
|
+
body: JSON.stringify(patch)
|
|
1195
|
+
});
|
|
1196
|
+
}
|
|
1197
|
+
export function deleteTag(tagId) {
|
|
1198
|
+
return request(`/api/v1/tags/${tagId}`, {
|
|
1199
|
+
method: "DELETE"
|
|
1200
|
+
});
|
|
1201
|
+
}
|
|
1202
|
+
export function getGoal(goalId) {
|
|
1203
|
+
return request(`/api/v1/goals/${goalId}`);
|
|
1204
|
+
}
|
|
1205
|
+
export function getProject(projectId) {
|
|
1206
|
+
return request(`/api/v1/projects/${projectId}`);
|
|
1207
|
+
}
|
|
1208
|
+
export function getProjectBoard(projectId) {
|
|
1209
|
+
return request(`/api/v1/projects/${projectId}/board`);
|
|
1210
|
+
}
|
|
1211
|
+
export function getOperatorContext() {
|
|
1212
|
+
return request("/api/v1/operator/context");
|
|
1213
|
+
}
|
|
1214
|
+
export function getOperatorOverview() {
|
|
1215
|
+
return request("/api/v1/operator/overview");
|
|
1216
|
+
}
|
|
1217
|
+
export function getSettings() {
|
|
1218
|
+
return request("/api/v1/settings");
|
|
1219
|
+
}
|
|
1220
|
+
export function saveAiModelConnection(input) {
|
|
1221
|
+
return request("/api/v1/settings/models/connections", {
|
|
1222
|
+
method: "POST",
|
|
1223
|
+
body: JSON.stringify(input)
|
|
1224
|
+
});
|
|
1225
|
+
}
|
|
1226
|
+
export function deleteAiModelConnection(connectionId) {
|
|
1227
|
+
return request(`/api/v1/settings/models/connections/${connectionId}`, {
|
|
1228
|
+
method: "DELETE"
|
|
1229
|
+
});
|
|
1230
|
+
}
|
|
1231
|
+
export function testAiModelConnection(input) {
|
|
1232
|
+
return request("/api/v1/settings/models/connections/test", {
|
|
1233
|
+
method: "POST",
|
|
1234
|
+
body: JSON.stringify(input)
|
|
1235
|
+
});
|
|
1236
|
+
}
|
|
1237
|
+
export function startOpenAiCodexOauth() {
|
|
1238
|
+
return request("/api/v1/settings/models/oauth/openai-codex/start", {
|
|
1239
|
+
method: "POST"
|
|
1240
|
+
});
|
|
1241
|
+
}
|
|
1242
|
+
export function getOpenAiCodexOauthSession(sessionId) {
|
|
1243
|
+
return request(`/api/v1/settings/models/oauth/openai-codex/session/${sessionId}`);
|
|
1244
|
+
}
|
|
1245
|
+
export function submitOpenAiCodexOauthManualCode(sessionId, codeOrUrl) {
|
|
1246
|
+
return request(`/api/v1/settings/models/oauth/openai-codex/session/${sessionId}/manual`, {
|
|
1247
|
+
method: "POST",
|
|
1248
|
+
body: JSON.stringify({ codeOrUrl })
|
|
1249
|
+
});
|
|
1250
|
+
}
|
|
1251
|
+
export function getSurfaceAiProcessors(surfaceId) {
|
|
1252
|
+
return request(`/api/v1/surfaces/${surfaceId}/ai-processors`);
|
|
1253
|
+
}
|
|
1254
|
+
export function getSurfaceLayout(surfaceId) {
|
|
1255
|
+
return request(`/api/v1/surfaces/${surfaceId}/layout`);
|
|
1256
|
+
}
|
|
1257
|
+
export function saveSurfaceLayout(surfaceId, payload) {
|
|
1258
|
+
return request(`/api/v1/surfaces/${surfaceId}/layout`, {
|
|
1259
|
+
method: "PUT",
|
|
1260
|
+
body: JSON.stringify(payload)
|
|
1261
|
+
});
|
|
1262
|
+
}
|
|
1263
|
+
export function resetSurfaceLayout(surfaceId) {
|
|
1264
|
+
return request(`/api/v1/surfaces/${surfaceId}/layout/reset`, {
|
|
1265
|
+
method: "POST"
|
|
1266
|
+
});
|
|
1267
|
+
}
|
|
1268
|
+
export function createAiProcessor(input) {
|
|
1269
|
+
return request(`/api/v1/surfaces/${input.surfaceId}/ai-processors`, {
|
|
1270
|
+
method: "POST",
|
|
1271
|
+
body: JSON.stringify(input)
|
|
1272
|
+
});
|
|
1273
|
+
}
|
|
1274
|
+
export function updateAiProcessor(processorId, patch) {
|
|
1275
|
+
return request(`/api/v1/ai-processors/${processorId}`, {
|
|
1276
|
+
method: "PATCH",
|
|
1277
|
+
body: JSON.stringify(patch)
|
|
1278
|
+
});
|
|
1279
|
+
}
|
|
1280
|
+
export function deleteAiProcessor(processorId) {
|
|
1281
|
+
return request(`/api/v1/ai-processors/${processorId}`, { method: "DELETE" });
|
|
1282
|
+
}
|
|
1283
|
+
export function createAiProcessorLink(input) {
|
|
1284
|
+
return request("/api/v1/ai-processor-links", {
|
|
1285
|
+
method: "POST",
|
|
1286
|
+
body: JSON.stringify(input)
|
|
1287
|
+
});
|
|
1288
|
+
}
|
|
1289
|
+
export function deleteAiProcessorLink(linkId) {
|
|
1290
|
+
return request(`/api/v1/ai-processor-links/${linkId}`, { method: "DELETE" });
|
|
1291
|
+
}
|
|
1292
|
+
export function runAiProcessor(processorId, input) {
|
|
1293
|
+
return request(`/api/v1/ai-processors/${processorId}/run`, {
|
|
1294
|
+
method: "POST",
|
|
1295
|
+
body: JSON.stringify(input)
|
|
1296
|
+
});
|
|
1297
|
+
}
|
|
1298
|
+
export function getAiProcessorBySlug(slug) {
|
|
1299
|
+
return request(`/api/v1/aiproc/${slug}`);
|
|
1300
|
+
}
|
|
1301
|
+
export function runAiProcessorBySlug(slug, input) {
|
|
1302
|
+
return request(`/api/v1/aiproc/${slug}/run`, {
|
|
1303
|
+
method: "POST",
|
|
1304
|
+
body: JSON.stringify(input)
|
|
1305
|
+
});
|
|
1306
|
+
}
|
|
1307
|
+
export function listWorkbenchBoxCatalog() {
|
|
1308
|
+
return request("/api/v1/workbench/catalog/boxes");
|
|
1309
|
+
}
|
|
1310
|
+
export function listWorkbenchFlows() {
|
|
1311
|
+
return request("/api/v1/workbench/flows");
|
|
1312
|
+
}
|
|
1313
|
+
export function createWorkbenchFlow(input) {
|
|
1314
|
+
return request("/api/v1/workbench/flows", {
|
|
1315
|
+
method: "POST",
|
|
1316
|
+
body: JSON.stringify(input)
|
|
1317
|
+
});
|
|
1318
|
+
}
|
|
1319
|
+
export function getWorkbenchFlow(connectorId) {
|
|
1320
|
+
return request(`/api/v1/workbench/flows/${connectorId}`);
|
|
1321
|
+
}
|
|
1322
|
+
export function updateWorkbenchFlow(connectorId, patch) {
|
|
1323
|
+
return request(`/api/v1/workbench/flows/${connectorId}`, {
|
|
1324
|
+
method: "PATCH",
|
|
1325
|
+
body: JSON.stringify(patch)
|
|
1326
|
+
});
|
|
1327
|
+
}
|
|
1328
|
+
export function deleteWorkbenchFlow(connectorId) {
|
|
1329
|
+
return request(`/api/v1/workbench/flows/${connectorId}`, {
|
|
1330
|
+
method: "DELETE"
|
|
1331
|
+
});
|
|
1332
|
+
}
|
|
1333
|
+
export function runWorkbenchFlow(connectorId, input) {
|
|
1334
|
+
return request(`/api/v1/workbench/flows/${connectorId}/run`, {
|
|
1335
|
+
method: "POST",
|
|
1336
|
+
body: JSON.stringify(input)
|
|
1337
|
+
});
|
|
1338
|
+
}
|
|
1339
|
+
export function chatWorkbenchFlow(connectorId, input) {
|
|
1340
|
+
return request(`/api/v1/workbench/flows/${connectorId}/chat`, {
|
|
1341
|
+
method: "POST",
|
|
1342
|
+
body: JSON.stringify(input)
|
|
1343
|
+
});
|
|
1344
|
+
}
|
|
1345
|
+
export function getWorkbenchFlowOutput(connectorId) {
|
|
1346
|
+
return request(`/api/v1/workbench/flows/${connectorId}/output`);
|
|
1347
|
+
}
|
|
1348
|
+
export function getWorkbenchFlowRuns(connectorId) {
|
|
1349
|
+
return request(`/api/v1/workbench/flows/${connectorId}/runs`);
|
|
1350
|
+
}
|
|
1351
|
+
export function getCompanionOverview(userIds) {
|
|
1352
|
+
const search = new URLSearchParams();
|
|
1353
|
+
appendUserIds(search, coerceUserIds(userIds));
|
|
1354
|
+
const suffix = search.size > 0 ? `?${search.toString()}` : "";
|
|
1355
|
+
return request(`/api/v1/health/overview${suffix}`);
|
|
1356
|
+
}
|
|
1357
|
+
export function getSleepView(userIds) {
|
|
1358
|
+
const search = new URLSearchParams();
|
|
1359
|
+
appendUserIds(search, coerceUserIds(userIds));
|
|
1360
|
+
const suffix = search.size > 0 ? `?${search.toString()}` : "";
|
|
1361
|
+
return request(`/api/v1/health/sleep${suffix}`);
|
|
1362
|
+
}
|
|
1363
|
+
export function getFitnessView(userIds) {
|
|
1364
|
+
const search = new URLSearchParams();
|
|
1365
|
+
appendUserIds(search, coerceUserIds(userIds));
|
|
1366
|
+
const suffix = search.size > 0 ? `?${search.toString()}` : "";
|
|
1367
|
+
return request(`/api/v1/health/fitness${suffix}`);
|
|
1368
|
+
}
|
|
1369
|
+
export function getMovementDay(input) {
|
|
1370
|
+
const search = new URLSearchParams();
|
|
1371
|
+
if (input?.date) {
|
|
1372
|
+
search.set("date", input.date);
|
|
1373
|
+
}
|
|
1374
|
+
appendUserIds(search, coerceUserIds(input?.userIds));
|
|
1375
|
+
const suffix = search.size > 0 ? `?${search.toString()}` : "";
|
|
1376
|
+
return request(`/api/v1/movement/day${suffix}`);
|
|
1377
|
+
}
|
|
1378
|
+
export function getMovementMonth(input) {
|
|
1379
|
+
const search = new URLSearchParams();
|
|
1380
|
+
if (input?.month) {
|
|
1381
|
+
search.set("month", input.month);
|
|
1382
|
+
}
|
|
1383
|
+
appendUserIds(search, coerceUserIds(input?.userIds));
|
|
1384
|
+
const suffix = search.size > 0 ? `?${search.toString()}` : "";
|
|
1385
|
+
return request(`/api/v1/movement/month${suffix}`);
|
|
1386
|
+
}
|
|
1387
|
+
export function getMovementAllTime(userIds) {
|
|
1388
|
+
const search = new URLSearchParams();
|
|
1389
|
+
appendUserIds(search, coerceUserIds(userIds));
|
|
1390
|
+
const suffix = search.size > 0 ? `?${search.toString()}` : "";
|
|
1391
|
+
return request(`/api/v1/movement/all-time${suffix}`);
|
|
1392
|
+
}
|
|
1393
|
+
export function getMovementSettings(userIds) {
|
|
1394
|
+
const search = new URLSearchParams();
|
|
1395
|
+
appendUserIds(search, coerceUserIds(userIds));
|
|
1396
|
+
const suffix = search.size > 0 ? `?${search.toString()}` : "";
|
|
1397
|
+
return request(`/api/v1/movement/settings${suffix}`);
|
|
1398
|
+
}
|
|
1399
|
+
export function patchMovementSettings(patch, userIds) {
|
|
1400
|
+
const search = new URLSearchParams();
|
|
1401
|
+
appendUserIds(search, coerceUserIds(userIds));
|
|
1402
|
+
const suffix = search.size > 0 ? `?${search.toString()}` : "";
|
|
1403
|
+
return request(`/api/v1/movement/settings${suffix}`, {
|
|
1404
|
+
method: "PATCH",
|
|
1405
|
+
body: JSON.stringify(patch)
|
|
1406
|
+
});
|
|
1407
|
+
}
|
|
1408
|
+
export function listMovementPlaces(userIds) {
|
|
1409
|
+
const search = new URLSearchParams();
|
|
1410
|
+
appendUserIds(search, coerceUserIds(userIds));
|
|
1411
|
+
const suffix = search.size > 0 ? `?${search.toString()}` : "";
|
|
1412
|
+
return request(`/api/v1/movement/places${suffix}`);
|
|
1413
|
+
}
|
|
1414
|
+
export function createMovementPlace(input, userIds) {
|
|
1415
|
+
const search = new URLSearchParams();
|
|
1416
|
+
appendUserIds(search, coerceUserIds(userIds));
|
|
1417
|
+
const suffix = search.size > 0 ? `?${search.toString()}` : "";
|
|
1418
|
+
return request(`/api/v1/movement/places${suffix}`, {
|
|
1419
|
+
method: "POST",
|
|
1420
|
+
body: JSON.stringify(input)
|
|
1421
|
+
});
|
|
1422
|
+
}
|
|
1423
|
+
export function patchMovementPlace(placeId, patch) {
|
|
1424
|
+
return request(`/api/v1/movement/places/${placeId}`, {
|
|
1425
|
+
method: "PATCH",
|
|
1426
|
+
body: JSON.stringify(patch)
|
|
1427
|
+
});
|
|
1428
|
+
}
|
|
1429
|
+
export function getMovementTripDetail(tripId) {
|
|
1430
|
+
return request(`/api/v1/movement/trips/${tripId}`);
|
|
1431
|
+
}
|
|
1432
|
+
export function getMovementTimeline(input) {
|
|
1433
|
+
const search = new URLSearchParams();
|
|
1434
|
+
if (input?.before) {
|
|
1435
|
+
search.set("before", input.before);
|
|
1436
|
+
}
|
|
1437
|
+
if (typeof input?.limit === "number") {
|
|
1438
|
+
search.set("limit", String(input.limit));
|
|
1439
|
+
}
|
|
1440
|
+
if (input?.includeInvalid) {
|
|
1441
|
+
search.set("includeInvalid", "true");
|
|
1442
|
+
}
|
|
1443
|
+
appendUserIds(search, coerceUserIds(input?.userIds));
|
|
1444
|
+
const suffix = search.size > 0 ? `?${search.toString()}` : "";
|
|
1445
|
+
return request(`/api/v1/movement/timeline${suffix}`);
|
|
1446
|
+
}
|
|
1447
|
+
export function patchMovementStay(stayId, patch) {
|
|
1448
|
+
return request(`/api/v1/movement/stays/${stayId}`, {
|
|
1449
|
+
method: "PATCH",
|
|
1450
|
+
body: JSON.stringify(patch)
|
|
1451
|
+
});
|
|
1452
|
+
}
|
|
1453
|
+
export function deleteMovementStay(stayId) {
|
|
1454
|
+
return request(`/api/v1/movement/stays/${stayId}`, {
|
|
1455
|
+
method: "DELETE"
|
|
1456
|
+
});
|
|
1457
|
+
}
|
|
1458
|
+
export function patchMovementTrip(tripId, patch) {
|
|
1459
|
+
return request(`/api/v1/movement/trips/${tripId}`, {
|
|
1460
|
+
method: "PATCH",
|
|
1461
|
+
body: JSON.stringify(patch)
|
|
1462
|
+
});
|
|
1463
|
+
}
|
|
1464
|
+
export function deleteMovementTrip(tripId) {
|
|
1465
|
+
return request(`/api/v1/movement/trips/${tripId}`, {
|
|
1466
|
+
method: "DELETE"
|
|
1467
|
+
});
|
|
1468
|
+
}
|
|
1469
|
+
export function patchMovementTripPoint(tripId, pointId, patch) {
|
|
1470
|
+
return request(`/api/v1/movement/trips/${tripId}/points/${pointId}`, {
|
|
1471
|
+
method: "PATCH",
|
|
1472
|
+
body: JSON.stringify(patch)
|
|
1473
|
+
});
|
|
1474
|
+
}
|
|
1475
|
+
export function deleteMovementTripPoint(tripId, pointId) {
|
|
1476
|
+
return request(`/api/v1/movement/trips/${tripId}/points/${pointId}`, {
|
|
1477
|
+
method: "DELETE"
|
|
1478
|
+
});
|
|
1479
|
+
}
|
|
1480
|
+
export function getMovementSelectionAggregate(input) {
|
|
1481
|
+
return request("/api/v1/movement/selection", {
|
|
1482
|
+
method: "POST",
|
|
1483
|
+
body: JSON.stringify(input)
|
|
1484
|
+
});
|
|
1485
|
+
}
|
|
1486
|
+
export function createCompanionPairingSession(input) {
|
|
1487
|
+
return request("/api/v1/health/pairing-sessions", {
|
|
1488
|
+
method: "POST",
|
|
1489
|
+
body: JSON.stringify(input ?? {})
|
|
1490
|
+
});
|
|
1491
|
+
}
|
|
1492
|
+
export function revokeCompanionPairingSession(pairingSessionId) {
|
|
1493
|
+
return request(`/api/v1/health/pairing-sessions/${pairingSessionId}`, {
|
|
1494
|
+
method: "DELETE"
|
|
1495
|
+
});
|
|
1496
|
+
}
|
|
1497
|
+
export function revokeAllCompanionPairingSessions(input) {
|
|
1498
|
+
return request("/api/v1/health/pairing-sessions/revoke-all", {
|
|
1499
|
+
method: "POST",
|
|
1500
|
+
body: JSON.stringify(input ?? {})
|
|
1501
|
+
});
|
|
1502
|
+
}
|
|
1503
|
+
export function patchWorkoutSession(workoutId, patch) {
|
|
1504
|
+
return request(`/api/v1/health/workouts/${workoutId}`, {
|
|
1505
|
+
method: "PATCH",
|
|
1506
|
+
body: JSON.stringify(patch)
|
|
1507
|
+
});
|
|
1508
|
+
}
|
|
1509
|
+
export function patchSleepSession(sleepId, patch) {
|
|
1510
|
+
return request(`/api/v1/health/sleep/${sleepId}`, {
|
|
1511
|
+
method: "PATCH",
|
|
1512
|
+
body: JSON.stringify(patch)
|
|
1513
|
+
});
|
|
1514
|
+
}
|
|
1515
|
+
export function listUsers() {
|
|
1516
|
+
return request("/api/v1/users");
|
|
1517
|
+
}
|
|
1518
|
+
export function getUserDirectory() {
|
|
1519
|
+
return request("/api/v1/users/directory");
|
|
1520
|
+
}
|
|
1521
|
+
export function patchUserAccessGrant(grantId, patch) {
|
|
1522
|
+
return request(`/api/v1/users/access-grants/${grantId}`, {
|
|
1523
|
+
method: "PATCH",
|
|
1524
|
+
body: JSON.stringify(patch)
|
|
1525
|
+
});
|
|
1526
|
+
}
|
|
1527
|
+
export function createUser(input) {
|
|
1528
|
+
return request("/api/v1/users", {
|
|
1529
|
+
method: "POST",
|
|
1530
|
+
body: JSON.stringify(input)
|
|
1531
|
+
});
|
|
1532
|
+
}
|
|
1533
|
+
export function patchUser(userId, patch) {
|
|
1534
|
+
return request(`/api/v1/users/${userId}`, {
|
|
1535
|
+
method: "PATCH",
|
|
1536
|
+
body: JSON.stringify(patch)
|
|
1537
|
+
});
|
|
1538
|
+
}
|
|
1539
|
+
export function listStrategies(userIds) {
|
|
1540
|
+
const search = new URLSearchParams();
|
|
1541
|
+
appendUserIds(search, coerceUserIds(userIds));
|
|
1542
|
+
const suffix = search.size > 0 ? `?${search.toString()}` : "";
|
|
1543
|
+
return request(`/api/v1/strategies${suffix}`);
|
|
1544
|
+
}
|
|
1545
|
+
export function createStrategy(input) {
|
|
1546
|
+
return request("/api/v1/strategies", {
|
|
1547
|
+
method: "POST",
|
|
1548
|
+
body: JSON.stringify(input)
|
|
1549
|
+
});
|
|
1550
|
+
}
|
|
1551
|
+
export function getStrategy(strategyId) {
|
|
1552
|
+
return request(`/api/v1/strategies/${strategyId}`);
|
|
1553
|
+
}
|
|
1554
|
+
export function patchStrategy(strategyId, patch) {
|
|
1555
|
+
return request(`/api/v1/strategies/${strategyId}`, {
|
|
1556
|
+
method: "PATCH",
|
|
1557
|
+
body: JSON.stringify(patch)
|
|
1558
|
+
});
|
|
1559
|
+
}
|
|
1560
|
+
export function deleteStrategy(strategyId) {
|
|
1561
|
+
return request(`/api/v1/strategies/${strategyId}`, {
|
|
1562
|
+
method: "DELETE"
|
|
1563
|
+
});
|
|
1564
|
+
}
|
|
1565
|
+
export function getSettingsBin() {
|
|
1566
|
+
return request("/api/v1/settings/bin");
|
|
1567
|
+
}
|
|
1568
|
+
export function listAgents() {
|
|
1569
|
+
return request("/api/v1/agents");
|
|
1570
|
+
}
|
|
1571
|
+
export function getAgentOnboarding() {
|
|
1572
|
+
return request("/api/v1/agents/onboarding");
|
|
1573
|
+
}
|
|
1574
|
+
export function listAgentActions(agentId) {
|
|
1575
|
+
return request(`/api/v1/agents/${agentId}/actions`);
|
|
1576
|
+
}
|
|
1577
|
+
export function listApprovalRequests() {
|
|
1578
|
+
return request("/api/v1/approval-requests");
|
|
1579
|
+
}
|
|
1580
|
+
export function approveApprovalRequest(approvalRequestId, note = "") {
|
|
1581
|
+
return request(`/api/v1/approval-requests/${approvalRequestId}/approve`, {
|
|
1582
|
+
method: "POST",
|
|
1583
|
+
body: JSON.stringify({ note })
|
|
1584
|
+
});
|
|
1585
|
+
}
|
|
1586
|
+
export function rejectApprovalRequest(approvalRequestId, note = "") {
|
|
1587
|
+
return request(`/api/v1/approval-requests/${approvalRequestId}/reject`, {
|
|
1588
|
+
method: "POST",
|
|
1589
|
+
body: JSON.stringify({ note })
|
|
1590
|
+
});
|
|
1591
|
+
}
|
|
1592
|
+
export function listRewardRules() {
|
|
1593
|
+
return request("/api/v1/rewards/rules");
|
|
1594
|
+
}
|
|
1595
|
+
export function getRewardRule(ruleId) {
|
|
1596
|
+
return request(`/api/v1/rewards/rules/${ruleId}`);
|
|
1597
|
+
}
|
|
1598
|
+
export function patchRewardRule(ruleId, patch) {
|
|
1599
|
+
return request(`/api/v1/rewards/rules/${ruleId}`, {
|
|
1600
|
+
method: "PATCH",
|
|
1601
|
+
body: JSON.stringify(patch)
|
|
1602
|
+
});
|
|
1603
|
+
}
|
|
1604
|
+
export function createManualRewardGrant(input) {
|
|
1605
|
+
return request("/api/v1/rewards/bonus", {
|
|
1606
|
+
method: "POST",
|
|
1607
|
+
body: JSON.stringify(input)
|
|
1608
|
+
});
|
|
1609
|
+
}
|
|
1610
|
+
export function listRewardLedger(limit = 50) {
|
|
1611
|
+
return request(`/api/v1/rewards/ledger?limit=${limit}`);
|
|
1612
|
+
}
|
|
1613
|
+
export function getXpMetrics() {
|
|
1614
|
+
return request("/api/v1/metrics/xp");
|
|
1615
|
+
}
|
|
1616
|
+
export function listEventLog(limit = 50) {
|
|
1617
|
+
return request(`/api/v1/events?limit=${limit}`);
|
|
1618
|
+
}
|
|
1619
|
+
export function patchSettings(input) {
|
|
1620
|
+
return request("/api/v1/settings", {
|
|
1621
|
+
method: "PATCH",
|
|
1622
|
+
body: JSON.stringify(input)
|
|
1623
|
+
});
|
|
1624
|
+
}
|
|
1625
|
+
export function createEntities(input) {
|
|
1626
|
+
return request("/api/v1/entities/create", {
|
|
1627
|
+
method: "POST",
|
|
1628
|
+
body: JSON.stringify(input)
|
|
1629
|
+
});
|
|
1630
|
+
}
|
|
1631
|
+
export function updateEntities(input) {
|
|
1632
|
+
return request("/api/v1/entities/update", {
|
|
1633
|
+
method: "POST",
|
|
1634
|
+
body: JSON.stringify(input)
|
|
1635
|
+
});
|
|
1636
|
+
}
|
|
1637
|
+
export function deleteEntities(input) {
|
|
1638
|
+
return request("/api/v1/entities/delete", {
|
|
1639
|
+
method: "POST",
|
|
1640
|
+
body: JSON.stringify(input)
|
|
1641
|
+
});
|
|
1642
|
+
}
|
|
1643
|
+
export function restoreEntities(input) {
|
|
1644
|
+
return request("/api/v1/entities/restore", {
|
|
1645
|
+
method: "POST",
|
|
1646
|
+
body: JSON.stringify(input)
|
|
1647
|
+
});
|
|
1648
|
+
}
|
|
1649
|
+
export function searchEntities(input) {
|
|
1650
|
+
return request("/api/v1/entities/search", {
|
|
1651
|
+
method: "POST",
|
|
1652
|
+
body: JSON.stringify(input)
|
|
1653
|
+
});
|
|
1654
|
+
}
|
|
1655
|
+
export function createAgentToken(input) {
|
|
1656
|
+
return request("/api/v1/settings/tokens", {
|
|
1657
|
+
method: "POST",
|
|
1658
|
+
body: JSON.stringify(input)
|
|
1659
|
+
});
|
|
1660
|
+
}
|
|
1661
|
+
export function createAgentAction(input) {
|
|
1662
|
+
return request("/api/v1/agent-actions", {
|
|
1663
|
+
method: "POST",
|
|
1664
|
+
body: JSON.stringify(input)
|
|
1665
|
+
});
|
|
1666
|
+
}
|
|
1667
|
+
export function rotateAgentToken(tokenId) {
|
|
1668
|
+
return request(`/api/v1/settings/tokens/${tokenId}/rotate`, {
|
|
1669
|
+
method: "POST"
|
|
1670
|
+
});
|
|
1671
|
+
}
|
|
1672
|
+
export function revokeAgentToken(tokenId) {
|
|
1673
|
+
return request(`/api/v1/settings/tokens/${tokenId}/revoke`, {
|
|
1674
|
+
method: "POST"
|
|
1675
|
+
});
|
|
1676
|
+
}
|
|
1677
|
+
export function listActivity(input = {}) {
|
|
1678
|
+
const search = new URLSearchParams();
|
|
1679
|
+
search.set("limit", String(input.limit ?? 100));
|
|
1680
|
+
if (input.entityType) {
|
|
1681
|
+
search.set("entityType", input.entityType);
|
|
1682
|
+
}
|
|
1683
|
+
if (input.entityId) {
|
|
1684
|
+
search.set("entityId", input.entityId);
|
|
1685
|
+
}
|
|
1686
|
+
if (input.includeCorrected) {
|
|
1687
|
+
search.set("includeCorrected", "true");
|
|
1688
|
+
}
|
|
1689
|
+
appendUserIds(search, coerceUserIds(input.userIds));
|
|
1690
|
+
return request(`/api/v1/activity?${search.toString()}`);
|
|
1691
|
+
}
|
|
1692
|
+
export function listDiagnosticLogs(input = {}) {
|
|
1693
|
+
const search = new URLSearchParams();
|
|
1694
|
+
search.set("limit", String(input.limit ?? 200));
|
|
1695
|
+
if (input.level) {
|
|
1696
|
+
search.set("level", input.level);
|
|
1697
|
+
}
|
|
1698
|
+
if (input.source) {
|
|
1699
|
+
search.set("source", input.source);
|
|
1700
|
+
}
|
|
1701
|
+
if (input.scope) {
|
|
1702
|
+
search.set("scope", input.scope);
|
|
1703
|
+
}
|
|
1704
|
+
if (input.route) {
|
|
1705
|
+
search.set("route", input.route);
|
|
1706
|
+
}
|
|
1707
|
+
if (input.entityType) {
|
|
1708
|
+
search.set("entityType", input.entityType);
|
|
1709
|
+
}
|
|
1710
|
+
if (input.entityId) {
|
|
1711
|
+
search.set("entityId", input.entityId);
|
|
1712
|
+
}
|
|
1713
|
+
if (input.jobId) {
|
|
1714
|
+
search.set("jobId", input.jobId);
|
|
1715
|
+
}
|
|
1716
|
+
if (input.search) {
|
|
1717
|
+
search.set("search", input.search);
|
|
1718
|
+
}
|
|
1719
|
+
if (input.beforeCreatedAt) {
|
|
1720
|
+
search.set("beforeCreatedAt", input.beforeCreatedAt);
|
|
1721
|
+
}
|
|
1722
|
+
if (input.beforeId) {
|
|
1723
|
+
search.set("beforeId", input.beforeId);
|
|
1724
|
+
}
|
|
1725
|
+
return request(`/api/v1/diagnostics/logs?${search.toString()}`);
|
|
1726
|
+
}
|
|
1727
|
+
export function createGoal(input) {
|
|
1728
|
+
return request("/api/v1/goals", {
|
|
1729
|
+
method: "POST",
|
|
1730
|
+
body: JSON.stringify({
|
|
1731
|
+
...input,
|
|
1732
|
+
notes: normalizeNestedNotes(input.notes)
|
|
1733
|
+
})
|
|
1734
|
+
});
|
|
1735
|
+
}
|
|
1736
|
+
export function createProject(input) {
|
|
1737
|
+
return request("/api/v1/projects", {
|
|
1738
|
+
method: "POST",
|
|
1739
|
+
body: JSON.stringify({
|
|
1740
|
+
...input,
|
|
1741
|
+
notes: normalizeNestedNotes(input.notes)
|
|
1742
|
+
})
|
|
1743
|
+
});
|
|
1744
|
+
}
|
|
1745
|
+
export function patchProject(projectId, patch) {
|
|
1746
|
+
return request(`/api/v1/projects/${projectId}`, {
|
|
1747
|
+
method: "PATCH",
|
|
1748
|
+
body: JSON.stringify(patch)
|
|
1749
|
+
});
|
|
1750
|
+
}
|
|
1751
|
+
export function deleteProject(projectId, mode = "soft") {
|
|
1752
|
+
const suffix = mode === "hard" ? "?mode=hard" : "";
|
|
1753
|
+
return request(`/api/v1/projects/${projectId}${suffix}`, {
|
|
1754
|
+
method: "DELETE"
|
|
1755
|
+
});
|
|
1756
|
+
}
|
|
1757
|
+
export function patchGoal(goalId, patch) {
|
|
1758
|
+
return request(`/api/v1/goals/${goalId}`, {
|
|
1759
|
+
method: "PATCH",
|
|
1760
|
+
body: JSON.stringify(patch)
|
|
1761
|
+
});
|
|
1762
|
+
}
|
|
1763
|
+
export function deleteGoal(goalId) {
|
|
1764
|
+
return request(`/api/v1/goals/${goalId}`, {
|
|
1765
|
+
method: "DELETE"
|
|
1766
|
+
});
|
|
1767
|
+
}
|
|
1768
|
+
export function createTask(input) {
|
|
1769
|
+
const normalized = {
|
|
1770
|
+
...input,
|
|
1771
|
+
goalId: input.goalId || null,
|
|
1772
|
+
projectId: input.projectId || null,
|
|
1773
|
+
dueDate: input.dueDate || null,
|
|
1774
|
+
notes: normalizeNestedNotes(input.notes)
|
|
1775
|
+
};
|
|
1776
|
+
return request("/api/v1/tasks", {
|
|
1777
|
+
method: "POST",
|
|
1778
|
+
body: JSON.stringify(normalized)
|
|
1779
|
+
});
|
|
1780
|
+
}
|
|
1781
|
+
export function patchTask(taskId, patch) {
|
|
1782
|
+
return request(`/api/v1/tasks/${taskId}`, {
|
|
1783
|
+
method: "PATCH",
|
|
1784
|
+
body: JSON.stringify({
|
|
1785
|
+
...patch,
|
|
1786
|
+
goalId: patch.goalId === "" ? null : patch.goalId,
|
|
1787
|
+
projectId: patch.projectId === "" ? null : patch.projectId,
|
|
1788
|
+
dueDate: patch.dueDate === "" ? null : patch.dueDate
|
|
1789
|
+
})
|
|
1790
|
+
});
|
|
1791
|
+
}
|
|
1792
|
+
export function deleteTask(taskId) {
|
|
1793
|
+
return request(`/api/v1/tasks/${taskId}`, {
|
|
1794
|
+
method: "DELETE"
|
|
1795
|
+
});
|
|
1796
|
+
}
|
|
1797
|
+
export function uncompleteTask(taskId) {
|
|
1798
|
+
return request(`/api/v1/tasks/${taskId}/uncomplete`, {
|
|
1799
|
+
method: "POST",
|
|
1800
|
+
body: JSON.stringify({})
|
|
1801
|
+
});
|
|
1802
|
+
}
|
|
1803
|
+
export function getTaskContext(taskId) {
|
|
1804
|
+
return request(`/api/v1/tasks/${taskId}/context`);
|
|
1805
|
+
}
|
|
1806
|
+
export function logOperatorWork(input) {
|
|
1807
|
+
return request("/api/v1/operator/log-work", {
|
|
1808
|
+
method: "POST",
|
|
1809
|
+
body: JSON.stringify(input)
|
|
1810
|
+
});
|
|
1811
|
+
}
|
|
1812
|
+
export function createWorkAdjustment(input) {
|
|
1813
|
+
return request("/api/v1/work-adjustments", {
|
|
1814
|
+
method: "POST",
|
|
1815
|
+
body: JSON.stringify(input)
|
|
1816
|
+
});
|
|
1817
|
+
}
|
|
1818
|
+
export function removeActivityLog(eventId, reason = "Removed from the visible archive.") {
|
|
1819
|
+
return request(`/api/v1/activity/${eventId}/remove`, {
|
|
1820
|
+
method: "POST",
|
|
1821
|
+
body: JSON.stringify({ reason })
|
|
1822
|
+
});
|
|
1823
|
+
}
|
|
1824
|
+
export function recordSessionEvent(input) {
|
|
1825
|
+
return request("/api/v1/session-events", {
|
|
1826
|
+
method: "POST",
|
|
1827
|
+
body: JSON.stringify(input)
|
|
1828
|
+
});
|
|
1829
|
+
}
|
|
1830
|
+
export function claimTaskRun(taskId, input) {
|
|
1831
|
+
return request(`/api/v1/tasks/${taskId}/runs`, {
|
|
1832
|
+
method: "POST",
|
|
1833
|
+
body: JSON.stringify(input)
|
|
1834
|
+
});
|
|
1835
|
+
}
|
|
1836
|
+
export function heartbeatTaskRun(taskRunId, input) {
|
|
1837
|
+
return request(`/api/v1/task-runs/${taskRunId}/heartbeat`, {
|
|
1838
|
+
method: "POST",
|
|
1839
|
+
body: JSON.stringify(input)
|
|
1840
|
+
});
|
|
1841
|
+
}
|
|
1842
|
+
export function focusTaskRun(taskRunId, input = {}) {
|
|
1843
|
+
return request(`/api/v1/task-runs/${taskRunId}/focus`, {
|
|
1844
|
+
method: "POST",
|
|
1845
|
+
body: JSON.stringify(input)
|
|
1846
|
+
});
|
|
1847
|
+
}
|
|
1848
|
+
export function completeTaskRun(taskRunId, input) {
|
|
1849
|
+
return request(`/api/v1/task-runs/${taskRunId}/complete`, {
|
|
1850
|
+
method: "POST",
|
|
1851
|
+
body: JSON.stringify(input)
|
|
1852
|
+
});
|
|
1853
|
+
}
|
|
1854
|
+
export function releaseTaskRun(taskRunId, input) {
|
|
1855
|
+
return request(`/api/v1/task-runs/${taskRunId}/release`, {
|
|
1856
|
+
method: "POST",
|
|
1857
|
+
body: JSON.stringify(input)
|
|
1858
|
+
});
|
|
1859
|
+
}
|