@faiber/faiber-manage 0.6.2
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 +59 -0
- package/dist/.tsbuildinfo +1 -0
- package/dist/index.d.ts +41 -0
- package/dist/index.d.ts.map +1 -0
- package/dist/index.js +126 -0
- package/dist/index.js.map +1 -0
- package/dist/stream.d.ts +7 -0
- package/dist/stream.d.ts.map +1 -0
- package/dist/stream.js +118 -0
- package/dist/stream.js.map +1 -0
- package/dist/types.d.ts +185 -0
- package/dist/types.d.ts.map +1 -0
- package/dist/types.js +2 -0
- package/dist/types.js.map +1 -0
- package/package.json +21 -0
package/README.md
ADDED
|
@@ -0,0 +1,59 @@
|
|
|
1
|
+
# @faiber/faiber-manage
|
|
2
|
+
|
|
3
|
+
Typed browser and server client for the project-scoped Faiber Manage gateway, including
|
|
4
|
+
service proxy origins and the Manage Agent interaction protocol.
|
|
5
|
+
|
|
6
|
+
```bash
|
|
7
|
+
npm install @faiber/faiber-manage
|
|
8
|
+
```
|
|
9
|
+
|
|
10
|
+
```ts
|
|
11
|
+
import {
|
|
12
|
+
FaiberClient,
|
|
13
|
+
ManageApi,
|
|
14
|
+
domainsFromManageProxy,
|
|
15
|
+
isManageAgentActionEvent,
|
|
16
|
+
parseManageAgentEvents,
|
|
17
|
+
} from "@faiber/faiber-manage";
|
|
18
|
+
|
|
19
|
+
const domains = domainsFromManageProxy(window.location.origin);
|
|
20
|
+
const manage = new ManageApi(new FaiberClient("manage", {
|
|
21
|
+
domains,
|
|
22
|
+
authMode: "cookie",
|
|
23
|
+
}));
|
|
24
|
+
|
|
25
|
+
const me = await manage.me();
|
|
26
|
+
const models = await manage.listAgentModels();
|
|
27
|
+
const thread = await manage.createAgentThread({ title: "Manage products" });
|
|
28
|
+
const stream = await manage.openAgentChatStream(thread.data.id, {
|
|
29
|
+
message: "Show products with low inventory",
|
|
30
|
+
agent_slug: "manage",
|
|
31
|
+
project_slug: me.data.project.slug,
|
|
32
|
+
});
|
|
33
|
+
|
|
34
|
+
for await (const event of parseManageAgentEvents(stream.data)) {
|
|
35
|
+
if (isManageAgentActionEvent(event)) {
|
|
36
|
+
// Render and confirm mutations before calling executeServiceAction.
|
|
37
|
+
console.log(event.data.arguments);
|
|
38
|
+
}
|
|
39
|
+
}
|
|
40
|
+
```
|
|
41
|
+
|
|
42
|
+
`listAgentModels` returns the Agentic model catalog used by helper settings and chat
|
|
43
|
+
composition. Durable chat management is available through `listAgentThreads`,
|
|
44
|
+
`getAgentMessages`, `cancelAgentChat`, and `deleteAgentThread`.
|
|
45
|
+
|
|
46
|
+
`domainsFromManageProxy` configures normal Faiber service clients through Manage's
|
|
47
|
+
project-scoped `/api/v1/proxy/{service}` boundary. Prefer those typed service clients for
|
|
48
|
+
known operations. `executeServiceAction` exists for runtime actions proposed by the Manage
|
|
49
|
+
Agent, and callers must review destructive or privileged actions before execution.
|
|
50
|
+
|
|
51
|
+
All methods return complete Axios responses. Request options accept headers, timeouts,
|
|
52
|
+
`AbortSignal`, credentials, adapters, and interceptors through the shared client. Cookie
|
|
53
|
+
mode is recommended because Manage sessions are HttpOnly and project scoped. Stream
|
|
54
|
+
requests default to Axios's fetch adapter so browser `ReadableStream` responses remain
|
|
55
|
+
incremental; consumers may supply another streaming adapter.
|
|
56
|
+
|
|
57
|
+
Axios errors retain HTTP status, response headers, request IDs, and backend details. Agent
|
|
58
|
+
event parsing is transport-only: it never auto-executes an action. The complete facade is
|
|
59
|
+
available from [`@faiber/faiber-ts-sdk`](https://www.npmjs.com/package/@faiber/faiber-ts-sdk).
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"fileNames":["../../../node_modules/typescript/lib/lib.es5.d.ts","../../../node_modules/typescript/lib/lib.es2015.d.ts","../../../node_modules/typescript/lib/lib.es2016.d.ts","../../../node_modules/typescript/lib/lib.es2017.d.ts","../../../node_modules/typescript/lib/lib.es2018.d.ts","../../../node_modules/typescript/lib/lib.es2019.d.ts","../../../node_modules/typescript/lib/lib.es2020.d.ts","../../../node_modules/typescript/lib/lib.es2021.d.ts","../../../node_modules/typescript/lib/lib.es2022.d.ts","../../../node_modules/typescript/lib/lib.dom.d.ts","../../../node_modules/typescript/lib/lib.dom.iterable.d.ts","../../../node_modules/typescript/lib/lib.es2015.core.d.ts","../../../node_modules/typescript/lib/lib.es2015.collection.d.ts","../../../node_modules/typescript/lib/lib.es2015.generator.d.ts","../../../node_modules/typescript/lib/lib.es2015.iterable.d.ts","../../../node_modules/typescript/lib/lib.es2015.promise.d.ts","../../../node_modules/typescript/lib/lib.es2015.proxy.d.ts","../../../node_modules/typescript/lib/lib.es2015.reflect.d.ts","../../../node_modules/typescript/lib/lib.es2015.symbol.d.ts","../../../node_modules/typescript/lib/lib.es2015.symbol.wellknown.d.ts","../../../node_modules/typescript/lib/lib.es2016.array.include.d.ts","../../../node_modules/typescript/lib/lib.es2016.intl.d.ts","../../../node_modules/typescript/lib/lib.es2017.arraybuffer.d.ts","../../../node_modules/typescript/lib/lib.es2017.date.d.ts","../../../node_modules/typescript/lib/lib.es2017.object.d.ts","../../../node_modules/typescript/lib/lib.es2017.sharedmemory.d.ts","../../../node_modules/typescript/lib/lib.es2017.string.d.ts","../../../node_modules/typescript/lib/lib.es2017.intl.d.ts","../../../node_modules/typescript/lib/lib.es2017.typedarrays.d.ts","../../../node_modules/typescript/lib/lib.es2018.asyncgenerator.d.ts","../../../node_modules/typescript/lib/lib.es2018.asynciterable.d.ts","../../../node_modules/typescript/lib/lib.es2018.intl.d.ts","../../../node_modules/typescript/lib/lib.es2018.promise.d.ts","../../../node_modules/typescript/lib/lib.es2018.regexp.d.ts","../../../node_modules/typescript/lib/lib.es2019.array.d.ts","../../../node_modules/typescript/lib/lib.es2019.object.d.ts","../../../node_modules/typescript/lib/lib.es2019.string.d.ts","../../../node_modules/typescript/lib/lib.es2019.symbol.d.ts","../../../node_modules/typescript/lib/lib.es2019.intl.d.ts","../../../node_modules/typescript/lib/lib.es2020.bigint.d.ts","../../../node_modules/typescript/lib/lib.es2020.date.d.ts","../../../node_modules/typescript/lib/lib.es2020.promise.d.ts","../../../node_modules/typescript/lib/lib.es2020.sharedmemory.d.ts","../../../node_modules/typescript/lib/lib.es2020.string.d.ts","../../../node_modules/typescript/lib/lib.es2020.symbol.wellknown.d.ts","../../../node_modules/typescript/lib/lib.es2020.intl.d.ts","../../../node_modules/typescript/lib/lib.es2020.number.d.ts","../../../node_modules/typescript/lib/lib.es2021.promise.d.ts","../../../node_modules/typescript/lib/lib.es2021.string.d.ts","../../../node_modules/typescript/lib/lib.es2021.weakref.d.ts","../../../node_modules/typescript/lib/lib.es2021.intl.d.ts","../../../node_modules/typescript/lib/lib.es2022.array.d.ts","../../../node_modules/typescript/lib/lib.es2022.error.d.ts","../../../node_modules/typescript/lib/lib.es2022.intl.d.ts","../../../node_modules/typescript/lib/lib.es2022.object.d.ts","../../../node_modules/typescript/lib/lib.es2022.string.d.ts","../../../node_modules/typescript/lib/lib.es2022.regexp.d.ts","../../../node_modules/typescript/lib/lib.decorators.d.ts","../../../node_modules/typescript/lib/lib.decorators.legacy.d.ts","../../../node_modules/axios/index.d.ts","../../core/dist/types.d.ts","../../core/dist/env.d.ts","../../core/dist/auth.d.ts","../../core/dist/client.d.ts","../../core/dist/resource.d.ts","../../core/dist/openapi.d.ts","../../core/dist/index.d.ts","../src/types.ts","../src/stream.ts","../src/index.ts"],"fileIdsList":[[61],[60,61],[60,61,62,63,64,65,66],[60,61,64],[60],[67,68,69],[67,68],[67]],"fileInfos":[{"version":"c430d44666289dae81f30fa7b2edebf186ecc91a2d4c71266ea6ae76388792e1","affectsGlobalScope":true,"impliedFormat":1},{"version":"45b7ab580deca34ae9729e97c13cfd999df04416a79116c3bfb483804f85ded4","impliedFormat":1},{"version":"3facaf05f0c5fc569c5649dd359892c98a85557e3e0c847964caeb67076f4d75","impliedFormat":1},{"version":"e44bb8bbac7f10ecc786703fe0a6a4b952189f908707980ba8f3c8975a760962","impliedFormat":1},{"version":"5e1c4c362065a6b95ff952c0eab010f04dcd2c3494e813b493ecfd4fcb9fc0d8","impliedFormat":1},{"version":"68d73b4a11549f9c0b7d352d10e91e5dca8faa3322bfb77b661839c42b1ddec7","impliedFormat":1},{"version":"5efce4fc3c29ea84e8928f97adec086e3dc876365e0982cc8479a07954a3efd4","impliedFormat":1},{"version":"feecb1be483ed332fad555aff858affd90a48ab19ba7272ee084704eb7167569","impliedFormat":1},{"version":"ee7bad0c15b58988daa84371e0b89d313b762ab83cb5b31b8a2d1162e8eb41c2","impliedFormat":1},{"version":"080941d9f9ff9307f7e27a83bcd888b7c8270716c39af943532438932ec1d0b9","affectsGlobalScope":true,"impliedFormat":1},{"version":"2e80ee7a49e8ac312cc11b77f1475804bee36b3b2bc896bead8b6e1266befb43","affectsGlobalScope":true,"impliedFormat":1},{"version":"c57796738e7f83dbc4b8e65132f11a377649c00dd3eee333f672b8f0a6bea671","affectsGlobalScope":true,"impliedFormat":1},{"version":"dc2df20b1bcdc8c2d34af4926e2c3ab15ffe1160a63e58b7e09833f616efff44","affectsGlobalScope":true,"impliedFormat":1},{"version":"515d0b7b9bea2e31ea4ec968e9edd2c39d3eebf4a2d5cbd04e88639819ae3b71","affectsGlobalScope":true,"impliedFormat":1},{"version":"0559b1f683ac7505ae451f9a96ce4c3c92bdc71411651ca6ddb0e88baaaad6a3","affectsGlobalScope":true,"impliedFormat":1},{"version":"0dc1e7ceda9b8b9b455c3a2d67b0412feab00bd2f66656cd8850e8831b08b537","affectsGlobalScope":true,"impliedFormat":1},{"version":"ce691fb9e5c64efb9547083e4a34091bcbe5bdb41027e310ebba8f7d96a98671","affectsGlobalScope":true,"impliedFormat":1},{"version":"8d697a2a929a5fcb38b7a65594020fcef05ec1630804a33748829c5ff53640d0","affectsGlobalScope":true,"impliedFormat":1},{"version":"4ff2a353abf8a80ee399af572debb8faab2d33ad38c4b4474cff7f26e7653b8d","affectsGlobalScope":true,"impliedFormat":1},{"version":"fb0f136d372979348d59b3f5020b4cdb81b5504192b1cacff5d1fbba29378aa1","affectsGlobalScope":true,"impliedFormat":1},{"version":"d15bea3d62cbbdb9797079416b8ac375ae99162a7fba5de2c6c505446486ac0a","affectsGlobalScope":true,"impliedFormat":1},{"version":"68d18b664c9d32a7336a70235958b8997ebc1c3b8505f4f1ae2b7e7753b87618","affectsGlobalScope":true,"impliedFormat":1},{"version":"eb3d66c8327153d8fa7dd03f9c58d351107fe824c79e9b56b462935176cdf12a","affectsGlobalScope":true,"impliedFormat":1},{"version":"38f0219c9e23c915ef9790ab1d680440d95419ad264816fa15009a8851e79119","affectsGlobalScope":true,"impliedFormat":1},{"version":"69ab18c3b76cd9b1be3d188eaf8bba06112ebbe2f47f6c322b5105a6fbc45a2e","affectsGlobalScope":true,"impliedFormat":1},{"version":"a680117f487a4d2f30ea46f1b4b7f58bef1480456e18ba53ee85c2746eeca012","affectsGlobalScope":true,"impliedFormat":1},{"version":"2f11ff796926e0832f9ae148008138ad583bd181899ab7dd768a2666700b1893","affectsGlobalScope":true,"impliedFormat":1},{"version":"4de680d5bb41c17f7f68e0419412ca23c98d5749dcaaea1896172f06435891fc","affectsGlobalScope":true,"impliedFormat":1},{"version":"954296b30da6d508a104a3a0b5d96b76495c709785c1d11610908e63481ee667","affectsGlobalScope":true,"impliedFormat":1},{"version":"ac9538681b19688c8eae65811b329d3744af679e0bdfa5d842d0e32524c73e1c","affectsGlobalScope":true,"impliedFormat":1},{"version":"0a969edff4bd52585473d24995c5ef223f6652d6ef46193309b3921d65dd4376","affectsGlobalScope":true,"impliedFormat":1},{"version":"9e9fbd7030c440b33d021da145d3232984c8bb7916f277e8ffd3dc2e3eae2bdb","affectsGlobalScope":true,"impliedFormat":1},{"version":"811ec78f7fefcabbda4bfa93b3eb67d9ae166ef95f9bff989d964061cbf81a0c","affectsGlobalScope":true,"impliedFormat":1},{"version":"717937616a17072082152a2ef351cb51f98802fb4b2fdabd32399843875974ca","affectsGlobalScope":true,"impliedFormat":1},{"version":"d7e7d9b7b50e5f22c915b525acc5a49a7a6584cf8f62d0569e557c5cfc4b2ac2","affectsGlobalScope":true,"impliedFormat":1},{"version":"71c37f4c9543f31dfced6c7840e068c5a5aacb7b89111a4364b1d5276b852557","affectsGlobalScope":true,"impliedFormat":1},{"version":"576711e016cf4f1804676043e6a0a5414252560eb57de9faceee34d79798c850","affectsGlobalScope":true,"impliedFormat":1},{"version":"89c1b1281ba7b8a96efc676b11b264de7a8374c5ea1e6617f11880a13fc56dc6","affectsGlobalScope":true,"impliedFormat":1},{"version":"74f7fa2d027d5b33eb0471c8e82a6c87216223181ec31247c357a3e8e2fddc5b","affectsGlobalScope":true,"impliedFormat":1},{"version":"d6d7ae4d1f1f3772e2a3cde568ed08991a8ae34a080ff1151af28b7f798e22ca","affectsGlobalScope":true,"impliedFormat":1},{"version":"063600664504610fe3e99b717a1223f8b1900087fab0b4cad1496a114744f8df","affectsGlobalScope":true,"impliedFormat":1},{"version":"934019d7e3c81950f9a8426d093458b65d5aff2c7c1511233c0fd5b941e608ab","affectsGlobalScope":true,"impliedFormat":1},{"version":"52ada8e0b6e0482b728070b7639ee42e83a9b1c22d205992756fe020fd9f4a47","affectsGlobalScope":true,"impliedFormat":1},{"version":"3bdefe1bfd4d6dee0e26f928f93ccc128f1b64d5d501ff4a8cf3c6371200e5e6","affectsGlobalScope":true,"impliedFormat":1},{"version":"59fb2c069260b4ba00b5643b907ef5d5341b167e7d1dbf58dfd895658bda2867","affectsGlobalScope":true,"impliedFormat":1},{"version":"639e512c0dfc3fad96a84caad71b8834d66329a1f28dc95e3946c9b58176c73a","affectsGlobalScope":true,"impliedFormat":1},{"version":"368af93f74c9c932edd84c58883e736c9e3d53cec1fe24c0b0ff451f529ceab1","affectsGlobalScope":true,"impliedFormat":1},{"version":"af3dd424cf267428f30ccfc376f47a2c0114546b55c44d8c0f1d57d841e28d74","affectsGlobalScope":true,"impliedFormat":1},{"version":"995c005ab91a498455ea8dfb63aa9f83fa2ea793c3d8aa344be4a1678d06d399","affectsGlobalScope":true,"impliedFormat":1},{"version":"959d36cddf5e7d572a65045b876f2956c973a586da58e5d26cde519184fd9b8a","affectsGlobalScope":true,"impliedFormat":1},{"version":"965f36eae237dd74e6cca203a43e9ca801ce38824ead814728a2807b1910117d","affectsGlobalScope":true,"impliedFormat":1},{"version":"3925a6c820dcb1a06506c90b1577db1fdbf7705d65b62b99dce4be75c637e26b","affectsGlobalScope":true,"impliedFormat":1},{"version":"0a3d63ef2b853447ec4f749d3f368ce642264246e02911fcb1590d8c161b8005","affectsGlobalScope":true,"impliedFormat":1},{"version":"8cdf8847677ac7d20486e54dd3fcf09eda95812ac8ace44b4418da1bbbab6eb8","affectsGlobalScope":true,"impliedFormat":1},{"version":"8444af78980e3b20b49324f4a16ba35024fef3ee069a0eb67616ea6ca821c47a","affectsGlobalScope":true,"impliedFormat":1},{"version":"3287d9d085fbd618c3971944b65b4be57859f5415f495b33a6adc994edd2f004","affectsGlobalScope":true,"impliedFormat":1},{"version":"b4b67b1a91182421f5df999988c690f14d813b9850b40acd06ed44691f6727ad","affectsGlobalScope":true,"impliedFormat":1},{"version":"8e7f8264d0fb4c5339605a15daadb037bf238c10b654bb3eee14208f860a32ea","affectsGlobalScope":true,"impliedFormat":1},{"version":"782dec38049b92d4e85c1585fbea5474a219c6984a35b004963b00beb1aab538","affectsGlobalScope":true,"impliedFormat":1},{"version":"2343ec253c90c370449755739733f5f429f58cffdb51a50977bb4a042012fa8f","impliedFormat":99},{"version":"6cc1f17dc5454eb1112cfb4a2e2ddc93de8c3f9016c8db7bdf0328caac374ffa","impliedFormat":99},{"version":"82065c5512d8d6f81b26cf13ea9ecd3e558be9560f7b5c62260858219ecd87f7","impliedFormat":99},{"version":"ed17ed1b2bcf384c88bc6cec6b427989b98db99fc7ad35a50605501a463bbc53","impliedFormat":99},{"version":"82bf4efcca8ab8764a91ac126c0af605ab6717ee94b2316461b5fa388b27e165","impliedFormat":99},{"version":"82ffc9a1d95766c8f6f6bb4316b1d83e9d6a1d4ec41057d1a897cca70176bfc1","impliedFormat":99},{"version":"3f5eeb0a84713ccf640b9a6af4629e006f59d7629abc3fc95af2efb062fd0b83","impliedFormat":99},{"version":"66a0cb4d019dd780c2fb5c2942778929ec55715bb5a0f3b80aac4c0b92e35d16","impliedFormat":99},{"version":"12fb392300d4c4c4f7f1426f6dbd0187f4743b7fe8409d1a29bbfd27b8ff8e38","signature":"9085a569ddd496ae3a4fe447345303b90c639f62d2415f4e0b304df08788b988","impliedFormat":99},{"version":"c95bb0315ce002f001a117fc2a5db960b3ee091a9d85460759fd5cdd3d3d076f","signature":"6618ba34b4b786d234e71ef5afbf355ff1eff0eb90d3ccdfc7f35b331dd331c9","impliedFormat":99},{"version":"abf166c4255eb0e07a747ebcca99285b8a349b3c194cf57117a02b621adec9cd","signature":"ea583de7927141d8fecf93cada06c5d2e602735288790f4a85b992516f4cb48a","impliedFormat":99}],"root":[[68,70]],"options":{"composite":true,"declaration":true,"declarationMap":true,"exactOptionalPropertyTypes":true,"module":199,"noUncheckedIndexedAccess":true,"outDir":"./","rootDir":"../src","skipLibCheck":true,"sourceMap":true,"strict":true,"target":9,"tsBuildInfoFile":"./.tsbuildinfo","verbatimModuleSyntax":true},"referencedMap":[[63,1],[64,2],[62,1],[67,3],[66,4],[65,4],[61,5],[70,6],[69,7],[68,8]],"latestChangedDtsFile":"./index.d.ts","version":"5.9.3"}
|
package/dist/index.d.ts
ADDED
|
@@ -0,0 +1,41 @@
|
|
|
1
|
+
import { ServiceApi, type JsonValue, type JsonObject, type RequestOptions, type ServiceDomains } from "@faiber/sdk-core";
|
|
2
|
+
import type * as T from "./types.js";
|
|
3
|
+
/** Builds service origins that retain Manage's authenticated, project-scoped proxy boundary. */
|
|
4
|
+
export declare function domainsFromManageProxy(root?: string): ServiceDomains;
|
|
5
|
+
/** Resolves the image URL from either supported Manage/Profile upload response envelope. */
|
|
6
|
+
export declare function managedImageUrl(response: T.ManageImageUploadResponse): string;
|
|
7
|
+
/** Typed client for project-scoped Manage APIs and its governed Agentic bridge. */
|
|
8
|
+
export declare class ManageApi extends ServiceApi {
|
|
9
|
+
/** Gets the active user, project, service catalog, and Agentic origin. */
|
|
10
|
+
me(options?: RequestOptions): Promise<import("axios").AxiosResponse<T.ManageMeResponse, any, {}>>;
|
|
11
|
+
/** Starts a development-only Manage session. Production deployments should disable this route. */
|
|
12
|
+
devLogin(data: T.ManageDevLoginInput, options?: RequestOptions<T.ManageDevLoginInput>): Promise<import("axios").AxiosResponse<T.ManageOkResponse, T.ManageDevLoginInput, {}>>;
|
|
13
|
+
/** Gets reachability state for services enabled in the current project. */
|
|
14
|
+
serviceHealth(options?: RequestOptions): Promise<import("axios").AxiosResponse<T.ManageServiceHealthResponse, any, {}>>;
|
|
15
|
+
/** Lists Agentic cloud model options and the user-configurable Ollama model contract. */
|
|
16
|
+
listAgentModels(options?: RequestOptions): Promise<import("axios").AxiosResponse<T.ManageAgentModelsResponse, any, {}>>;
|
|
17
|
+
/** Uploads a project-scoped profile image through Manage's validated service proxy. */
|
|
18
|
+
uploadProfileImage(input: T.ManageImageUploadInput, options?: RequestOptions<FormData>): Promise<import("axios").AxiosResponse<T.ManageImageUploadResponse, FormData, {}>>;
|
|
19
|
+
/** Creates the Agentic thread used by the builtin Manage agent. */
|
|
20
|
+
createAgentThread(data: T.ManageAgentThreadInput, options?: RequestOptions<T.ManageAgentThreadInput>): Promise<import("axios").AxiosResponse<T.ManageAgentThreadResponse, T.ManageAgentThreadInput, {}>>;
|
|
21
|
+
/** Lists durable Agentic threads owned by the active Manage user. */
|
|
22
|
+
listAgentThreads(options?: RequestOptions): Promise<import("axios").AxiosResponse<T.ManageAgentThreadResponse[], any, {}>>;
|
|
23
|
+
/** Gets durable messages for one Agentic thread, including snapshot change metadata when present. */
|
|
24
|
+
getAgentMessages(threadId: string, options?: RequestOptions): Promise<import("axios").AxiosResponse<T.ManageAgentMessage[], any, {}>>;
|
|
25
|
+
/** Opens a POST SSE response while preserving the complete Axios response and headers. */
|
|
26
|
+
openAgentChatStream(threadId: string, data: T.ManageAgentChatInput, options?: RequestOptions<T.ManageAgentChatInput>): Promise<import("axios").AxiosResponse<T.ManageAgentStreamBody, T.ManageAgentChatInput, {}>>;
|
|
27
|
+
/** Cancels the active Agentic run identified by the stable client message ID. */
|
|
28
|
+
cancelAgentChat(threadId: string, data: T.ManageAgentCancelInput, options?: RequestOptions<T.ManageAgentCancelInput>): Promise<import("axios").AxiosResponse<T.ManageAgentCancelResponse, T.ManageAgentCancelInput, {}>>;
|
|
29
|
+
/** Permanently deletes a user-owned Agentic thread and its durable messages. */
|
|
30
|
+
deleteAgentThread(threadId: string, options?: RequestOptions): Promise<import("axios").AxiosResponse<T.ManageOkResponse, any, {}>>;
|
|
31
|
+
/** Reports the reviewed execution result of an Agentic browser action. */
|
|
32
|
+
completeAgentAction(actionId: string, data: T.ManageAgentActionCompletionInput, options?: RequestOptions<T.ManageAgentActionCompletionInput>): Promise<import("axios").AxiosResponse<T.ManageOkResponse, T.ManageAgentActionCompletionInput, {}>>;
|
|
33
|
+
/** Supplies a user answer requested by the Manage agent. */
|
|
34
|
+
completeAgentQuestion(askId: string, data: T.ManageAgentQuestionCompletionInput, options?: RequestOptions<T.ManageAgentQuestionCompletionInput>): Promise<import("axios").AxiosResponse<T.ManageOkResponse, T.ManageAgentQuestionCompletionInput, {}>>;
|
|
35
|
+
/** Executes a reviewed runtime service operation through the project-scoped proxy. */
|
|
36
|
+
executeServiceAction<TResponse extends JsonValue = JsonValue, TData extends JsonValue = JsonObject>(action: T.ManageServiceAction<TData>, options?: RequestOptions<TData>): Promise<import("axios").AxiosResponse<TResponse, TData, {}>>;
|
|
37
|
+
}
|
|
38
|
+
export * from "./types.js";
|
|
39
|
+
export * from "./stream.js";
|
|
40
|
+
export * from "@faiber/sdk-core";
|
|
41
|
+
//# sourceMappingURL=index.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mapp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oBAAoB,CAAC;IAYlD,iFAAiF;IACjF,eAAe,CACb,QAAQ,EAAE,MAAM,EAChB,IAAI,EAAE,CAAC,CAAC,sBAAsB,EAC9B,OAAO,CAAC,EAAE,cAAc,CAAC,CAAC,CAAC,sBAAsB,CAAC;IASpD,gFAAgF;IAChF,iBAAiB,CAAC,QAAQ,EAAE,MAAM,EAAE,OAAO,CAAC,EAAE,cAAc;IAO5D,0EAA0E;IAC1E,mBAAmB,CACjB,QAAQ,EAAE,MAAM,EAChB,IAAI,EAAE,CAAC,CAAC,gCAAgC,EACxC,OAAO,CAAC,EAAE,cAAc,CAAC,CAAC,CAAC,gCAAgC,CAAC;IAS9D,4DAA4D;IAC5D,qBAAqB,CACnB,KAAK,EAAE,MAAM,EACb,IAAI,EAAE,CAAC,CAAC,kCAAkC,EAC1C,OAAO,CAAC,EAAE,cAAc,CAAC,CAAC,CAAC,kCAAkC,CAAC;IAShE,sFAAsF;IACtF,oBAAoB,CAAC,SAAS,SAAS,SAAS,GAAG,SAAS,EAAE,KAAK,SAAS,SAAS,GAAG,UAAU,EAChG,MAAM,EAAE,CAAC,CAAC,mBAAmB,CAAC,KAAK,CAAC,EACpC,OAAO,CAAC,EAAE,cAAc,CAAC,KAAK,CAAC;CAUlC;AAED,cAAc,YAAY,CAAC;AAC3B,cAAc,aAAa,CAAC;AAC5B,cAAc,kBAAkB,CAAC"}
|
package/dist/index.js
ADDED
|
@@ -0,0 +1,126 @@
|
|
|
1
|
+
import { SERVICE_NAMES, ServiceApi, } from "@faiber/sdk-core";
|
|
2
|
+
function encode(value) {
|
|
3
|
+
return encodeURIComponent(value);
|
|
4
|
+
}
|
|
5
|
+
function safeServicePath(path) {
|
|
6
|
+
const trimmed = path.trim();
|
|
7
|
+
const pathname = trimmed.split("?", 1)[0] ?? "";
|
|
8
|
+
const segments = pathname.split("/");
|
|
9
|
+
if (!trimmed.startsWith("/")
|
|
10
|
+
|| trimmed.startsWith("//")
|
|
11
|
+
|| trimmed.includes("://")
|
|
12
|
+
|| trimmed.includes(String.fromCharCode(92))
|
|
13
|
+
|| segments.includes(".")
|
|
14
|
+
|| segments.includes("..")) {
|
|
15
|
+
throw new Error("Manage service actions require an absolute service path, not a URL");
|
|
16
|
+
}
|
|
17
|
+
return trimmed;
|
|
18
|
+
}
|
|
19
|
+
function rootWithoutTrailingSlash(root) {
|
|
20
|
+
let normalized = root.trim();
|
|
21
|
+
while (normalized.endsWith("/"))
|
|
22
|
+
normalized = normalized.slice(0, -1);
|
|
23
|
+
if (normalized.includes("?") || normalized.includes("#")) {
|
|
24
|
+
throw new Error("Manage root must not contain a query string or fragment");
|
|
25
|
+
}
|
|
26
|
+
return normalized;
|
|
27
|
+
}
|
|
28
|
+
/** Builds service origins that retain Manage's authenticated, project-scoped proxy boundary. */
|
|
29
|
+
export function domainsFromManageProxy(root = "") {
|
|
30
|
+
const normalized = rootWithoutTrailingSlash(root);
|
|
31
|
+
const domains = { manage: normalized || "/" };
|
|
32
|
+
for (const service of SERVICE_NAMES) {
|
|
33
|
+
if (service !== "manage")
|
|
34
|
+
domains[service] = `${normalized}/api/v1/proxy/${service}`;
|
|
35
|
+
}
|
|
36
|
+
return domains;
|
|
37
|
+
}
|
|
38
|
+
/** Resolves the image URL from either supported Manage/Profile upload response envelope. */
|
|
39
|
+
export function managedImageUrl(response) {
|
|
40
|
+
const url = response.data?.url ?? response.url;
|
|
41
|
+
if (!url)
|
|
42
|
+
throw new Error("Image upload completed without a URL");
|
|
43
|
+
return url;
|
|
44
|
+
}
|
|
45
|
+
/** Typed client for project-scoped Manage APIs and its governed Agentic bridge. */
|
|
46
|
+
export class ManageApi extends ServiceApi {
|
|
47
|
+
/** Gets the active user, project, service catalog, and Agentic origin. */
|
|
48
|
+
me(options) {
|
|
49
|
+
return this.client.get("/api/v1/me", undefined, options);
|
|
50
|
+
}
|
|
51
|
+
/** Starts a development-only Manage session. Production deployments should disable this route. */
|
|
52
|
+
devLogin(data, options) {
|
|
53
|
+
return this.client.post("/api/v1/dev/login", data, options);
|
|
54
|
+
}
|
|
55
|
+
/** Gets reachability state for services enabled in the current project. */
|
|
56
|
+
serviceHealth(options) {
|
|
57
|
+
return this.client.get("/api/v1/health/services", undefined, options);
|
|
58
|
+
}
|
|
59
|
+
/** Lists Agentic cloud model options and the user-configurable Ollama model contract. */
|
|
60
|
+
listAgentModels(options) {
|
|
61
|
+
return this.client.get("/api/v1/agent/models", undefined, options);
|
|
62
|
+
}
|
|
63
|
+
/** Uploads a project-scoped profile image through Manage's validated service proxy. */
|
|
64
|
+
uploadProfileImage(input, options) {
|
|
65
|
+
const data = new FormData();
|
|
66
|
+
if (input.fileName === undefined)
|
|
67
|
+
data.append("file", input.file);
|
|
68
|
+
else
|
|
69
|
+
data.append("file", input.file, input.fileName);
|
|
70
|
+
data.append("pet_id", `manage-${input.scope}`.replace(/[^a-zA-Z0-9_-]/g, "-"));
|
|
71
|
+
return this.client.post(`/api/v1/proxy/profile/api/v1/profile/${encode(input.userId)}/avatar`, data, options);
|
|
72
|
+
}
|
|
73
|
+
/** Creates the Agentic thread used by the builtin Manage agent. */
|
|
74
|
+
createAgentThread(data, options) {
|
|
75
|
+
return this.client.post("/api/v1/agent/chat/threads", { ide_mode: "code", ...data }, options);
|
|
76
|
+
}
|
|
77
|
+
/** Lists durable Agentic threads owned by the active Manage user. */
|
|
78
|
+
listAgentThreads(options) {
|
|
79
|
+
return this.client.get("/api/v1/agent/chat/threads", undefined, options);
|
|
80
|
+
}
|
|
81
|
+
/** Gets durable messages for one Agentic thread, including snapshot change metadata when present. */
|
|
82
|
+
getAgentMessages(threadId, options) {
|
|
83
|
+
return this.client.get(`/api/v1/agent/ide/threads/${encode(threadId)}/messages`, undefined, options);
|
|
84
|
+
}
|
|
85
|
+
/** Opens a POST SSE response while preserving the complete Axios response and headers. */
|
|
86
|
+
openAgentChatStream(threadId, data, options) {
|
|
87
|
+
return this.client.request({
|
|
88
|
+
...options,
|
|
89
|
+
method: "POST",
|
|
90
|
+
url: `/api/v1/agent/ide/threads/${encode(threadId)}/chat/stream`,
|
|
91
|
+
data,
|
|
92
|
+
responseType: "stream",
|
|
93
|
+
adapter: options?.adapter ?? "fetch",
|
|
94
|
+
});
|
|
95
|
+
}
|
|
96
|
+
/** Cancels the active Agentic run identified by the stable client message ID. */
|
|
97
|
+
cancelAgentChat(threadId, data, options) {
|
|
98
|
+
return this.client.post(`/api/v1/agent/ide/threads/${encode(threadId)}/chat/cancel`, data, options);
|
|
99
|
+
}
|
|
100
|
+
/** Permanently deletes a user-owned Agentic thread and its durable messages. */
|
|
101
|
+
deleteAgentThread(threadId, options) {
|
|
102
|
+
return this.client.delete(`/api/v1/agent/ide/threads/${encode(threadId)}`, options);
|
|
103
|
+
}
|
|
104
|
+
/** Reports the reviewed execution result of an Agentic browser action. */
|
|
105
|
+
completeAgentAction(actionId, data, options) {
|
|
106
|
+
return this.client.post(`/api/v1/agent/browser/actions/${encode(actionId)}/complete`, data, options);
|
|
107
|
+
}
|
|
108
|
+
/** Supplies a user answer requested by the Manage agent. */
|
|
109
|
+
completeAgentQuestion(askId, data, options) {
|
|
110
|
+
return this.client.post(`/api/v1/agent/ask/${encode(askId)}/complete`, data, options);
|
|
111
|
+
}
|
|
112
|
+
/** Executes a reviewed runtime service operation through the project-scoped proxy. */
|
|
113
|
+
executeServiceAction(action, options) {
|
|
114
|
+
const path = safeServicePath(action.path);
|
|
115
|
+
return this.client.request({
|
|
116
|
+
...options,
|
|
117
|
+
method: action.method,
|
|
118
|
+
url: `/api/v1/proxy/${encode(action.service)}${path}`,
|
|
119
|
+
...(action.body === undefined ? {} : { data: action.body }),
|
|
120
|
+
});
|
|
121
|
+
}
|
|
122
|
+
}
|
|
123
|
+
export * from "./types.js";
|
|
124
|
+
export * from "./stream.js";
|
|
125
|
+
export * from "@faiber/sdk-core";
|
|
126
|
+
//# sourceMappingURL=index.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"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C1C,OAAO,IAAI,CAAC,MAAM,CAAC,OAAO,CAAmB;YAC3C,GAAG,OAAO;YACV,MAAM,EAAE,MAAM,CAAC,MAAM;YACrB,GAAG,EAAE,iBAAiB,MAAM,CAAC,MAAM,CAAC,OAAO,CAAC,GAAG,IAAI,EAAE;YACrD,GAAG,CAAC,MAAM,CAAC,IAAI,KAAK,SAAS,CAAC,CAAC,CAAC,EAAE,CAAC,CAAC,CAAC,EAAE,IAAI,EAAE,MAAM,CAAC,IAAI,EAAE,CAAC;SAC5D,CAAC,CAAC;IACL,CAAC;CACF;AAED,cAAc,YAAY,CAAC;AAC3B,cAAc,aAAa,CAAC;AAC5B,cAAc,kBAAkB,CAAC"}
|
package/dist/stream.d.ts
ADDED
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
import type { ManageAgentActionEvent, ManageAgentCompleteEvent, ManageAgentEvent, ManageAgentQuestionEvent, ManageAgentStreamBody } from "./types.js";
|
|
2
|
+
/** Incrementally parses standard SSE blocks from browser ReadableStreams, Node streams, or text. */
|
|
3
|
+
export declare function parseManageAgentEvents(body: ManageAgentStreamBody): AsyncGenerator<ManageAgentEvent>;
|
|
4
|
+
export declare function isManageAgentActionEvent(event: ManageAgentEvent): event is ManageAgentActionEvent;
|
|
5
|
+
export declare function isManageAgentQuestionEvent(event: ManageAgentEvent): event is ManageAgentQuestionEvent;
|
|
6
|
+
export declare function isManageAgentCompleteEvent(event: ManageAgentEvent): event is ManageAgentCompleteEvent;
|
|
7
|
+
//# sourceMappingURL=stream.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"stream.d.ts","sourceRoot":"","sources":["../src/stream.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EACV,sBAAsB,EACtB,wBAAwB,EACxB,gBAAgB,EAChB,wBAAwB,EACxB,qBAAqB,EACtB,MAAM,YAAY,CAAC;AAgEpB,oGAAoG;AACpG,wBAAuB,sBAAsB,CAAC,IAAI,EAAE,qBAAqB,GAAG,cAAc,CAAC,gBAAgB,CAAC,CA0B3G;AAQD,wBAAgB,wBAAwB,CAAC,KAAK,EAAE,gBAAgB,GAAG,KAAK,IAAI,sBAAsB,CAGjG;AAED,wBAAgB,0BAA0B,CAAC,KAAK,EAAE,gBAAgB,GAAG,KAAK,IAAI,wBAAwB,CAGrG;AAED,wBAAgB,0BAA0B,CAAC,KAAK,EAAE,gBAAgB,GAAG,KAAK,IAAI,wBAAwB,CAGrG"}
|
package/dist/stream.js
ADDED
|
@@ -0,0 +1,118 @@
|
|
|
1
|
+
function isReadableStream(body) {
|
|
2
|
+
return typeof body !== "string" && "getReader" in body;
|
|
3
|
+
}
|
|
4
|
+
async function* streamChunks(body) {
|
|
5
|
+
if (typeof body === "string") {
|
|
6
|
+
yield body;
|
|
7
|
+
return;
|
|
8
|
+
}
|
|
9
|
+
if (isReadableStream(body)) {
|
|
10
|
+
const reader = body.getReader();
|
|
11
|
+
try {
|
|
12
|
+
while (true) {
|
|
13
|
+
const part = await reader.read();
|
|
14
|
+
if (part.done)
|
|
15
|
+
break;
|
|
16
|
+
yield part.value;
|
|
17
|
+
}
|
|
18
|
+
}
|
|
19
|
+
finally {
|
|
20
|
+
reader.releaseLock();
|
|
21
|
+
}
|
|
22
|
+
return;
|
|
23
|
+
}
|
|
24
|
+
for await (const part of body)
|
|
25
|
+
yield part;
|
|
26
|
+
}
|
|
27
|
+
function parseEventBlock(block) {
|
|
28
|
+
let event = "message";
|
|
29
|
+
let id;
|
|
30
|
+
let retry;
|
|
31
|
+
const data = [];
|
|
32
|
+
for (const line of block.replaceAll("\r\n", "\n").split("\n")) {
|
|
33
|
+
if (!line || line.startsWith(":"))
|
|
34
|
+
continue;
|
|
35
|
+
const separator = line.indexOf(":");
|
|
36
|
+
const field = separator === -1 ? line : line.slice(0, separator);
|
|
37
|
+
const value = separator === -1 ? "" : line.slice(separator + 1).replace(/^ /, "");
|
|
38
|
+
if (field === "event")
|
|
39
|
+
event = value;
|
|
40
|
+
else if (field === "data")
|
|
41
|
+
data.push(value);
|
|
42
|
+
else if (field === "id")
|
|
43
|
+
id = value;
|
|
44
|
+
else if (field === "retry") {
|
|
45
|
+
const parsed = Number(value);
|
|
46
|
+
if (Number.isFinite(parsed))
|
|
47
|
+
retry = parsed;
|
|
48
|
+
}
|
|
49
|
+
}
|
|
50
|
+
if (!data.length)
|
|
51
|
+
return null;
|
|
52
|
+
const serialized = data.join("\n");
|
|
53
|
+
let value = serialized;
|
|
54
|
+
if (event !== "phase") {
|
|
55
|
+
try {
|
|
56
|
+
value = JSON.parse(serialized);
|
|
57
|
+
}
|
|
58
|
+
catch {
|
|
59
|
+
value = serialized;
|
|
60
|
+
}
|
|
61
|
+
}
|
|
62
|
+
return {
|
|
63
|
+
event,
|
|
64
|
+
data: value,
|
|
65
|
+
raw: block,
|
|
66
|
+
...(id === undefined ? {} : { id }),
|
|
67
|
+
...(retry === undefined ? {} : { retry }),
|
|
68
|
+
};
|
|
69
|
+
}
|
|
70
|
+
/** Incrementally parses standard SSE blocks from browser ReadableStreams, Node streams, or text. */
|
|
71
|
+
export async function* parseManageAgentEvents(body) {
|
|
72
|
+
const decoder = new TextDecoder();
|
|
73
|
+
let buffer = "";
|
|
74
|
+
for await (const chunk of streamChunks(body)) {
|
|
75
|
+
buffer += typeof chunk === "string" ? chunk : decoder.decode(chunk, { stream: true });
|
|
76
|
+
while (true) {
|
|
77
|
+
const lfBoundary = buffer.indexOf("\n\n");
|
|
78
|
+
const crlfBoundary = buffer.indexOf("\r\n\r\n");
|
|
79
|
+
const boundary = lfBoundary === -1
|
|
80
|
+
? crlfBoundary
|
|
81
|
+
: crlfBoundary === -1
|
|
82
|
+
? lfBoundary
|
|
83
|
+
: Math.min(lfBoundary, crlfBoundary);
|
|
84
|
+
if (boundary === -1)
|
|
85
|
+
break;
|
|
86
|
+
const separatorLength = buffer.startsWith("\r\n\r\n", boundary) ? 4 : 2;
|
|
87
|
+
const block = buffer.slice(0, boundary);
|
|
88
|
+
buffer = buffer.slice(boundary + separatorLength);
|
|
89
|
+
const parsed = parseEventBlock(block);
|
|
90
|
+
if (parsed)
|
|
91
|
+
yield parsed;
|
|
92
|
+
}
|
|
93
|
+
}
|
|
94
|
+
buffer += decoder.decode();
|
|
95
|
+
if (buffer.trim()) {
|
|
96
|
+
const parsed = parseEventBlock(buffer);
|
|
97
|
+
if (parsed)
|
|
98
|
+
yield parsed;
|
|
99
|
+
}
|
|
100
|
+
}
|
|
101
|
+
function objectData(event) {
|
|
102
|
+
return typeof event.data === "object" && event.data !== null && !Array.isArray(event.data)
|
|
103
|
+
? event.data
|
|
104
|
+
: null;
|
|
105
|
+
}
|
|
106
|
+
export function isManageAgentActionEvent(event) {
|
|
107
|
+
const data = objectData(event);
|
|
108
|
+
return event.event === "browser_action" && typeof data?.action_id === "string" && typeof data.name === "string";
|
|
109
|
+
}
|
|
110
|
+
export function isManageAgentQuestionEvent(event) {
|
|
111
|
+
const data = objectData(event);
|
|
112
|
+
return event.event === "ask_user" && typeof data?.ask_id === "string" && typeof data.question === "string";
|
|
113
|
+
}
|
|
114
|
+
export function isManageAgentCompleteEvent(event) {
|
|
115
|
+
const data = objectData(event);
|
|
116
|
+
return event.event === "complete" && typeof data?.message === "string";
|
|
117
|
+
}
|
|
118
|
+
//# sourceMappingURL=stream.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"stream.js","sourceRoot":"","sources":["../src/stream.ts"],"names":[],"mappings":"AASA,SAAS,gBAAgB,CAAC,IAA2B;IACnD,OAAO,OAAO,IAAI,KAAK,QAAQ,IAAI,WAAW,IAAI,IAAI,CAAC;AACzD,CAAC;AAED,KAAK,SAAS,CAAC,CAAC,YAAY,CAAC,IAA2B;IACtD,IAAI,OAAO,IAAI,KAAK,QAAQ,EAAE,CAAC;QAC7B,MAAM,IAAI,CAAC;QACX,OAAO;IACT,CAAC;IACD,IAAI,gBAAgB,CAAC,IAAI,CAAC,EAAE,CAAC;QAC3B,MAAM,MAAM,GAAG,IA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CAAC,KAAuB;IACzC,OAAO,OAAO,KAAK,CAAC,IAAI,KAAK,QAAQ,IAAI,KAAK,CAAC,IAAI,KAAK,IAAI,IAAI,CAAC,KAAK,CAAC,OAAO,CAAC,KAAK,CAAC,IAAI,CAAC;QACxF,CAAC,CAAC,KAAK,CAAC,IAAkB;QAC1B,CAAC,CAAC,IAAI,CAAC;AACX,CAAC;AAED,MAAM,UAAU,wBAAwB,CAAC,KAAuB;IAC9D,MAAM,IAAI,GAAG,UAAU,CAAC,KAAK,CAAC,CAAC;IAC/B,OAAO,KAAK,CAAC,KAAK,KAAK,gBAAgB,IAAI,OAAO,IAAI,EAAE,SAAS,KAAK,QAAQ,IAAI,OAAO,IAAI,CAAC,IAAI,KAAK,QAAQ,CAAC;AAClH,CAAC;AAED,MAAM,UAAU,0BAA0B,CAAC,KAAuB;IAChE,MAAM,IAAI,GAAG,UAAU,CAAC,KAAK,CAAC,CAAC;IAC/B,OAAO,KAAK,CAAC,KAAK,KAAK,UAAU,IAAI,OAAO,IAAI,EAAE,MAAM,KAAK,QAAQ,IAAI,OAAO,IAAI,CAAC,QAAQ,KAAK,QAAQ,CAAC;AAC7G,CAAC;AAED,MAAM,UAAU,0BAA0B,CAAC,KAAuB;IAChE,MAAM,IAAI,GAAG,UAAU,CAAC,KAAK,CAAC,CAAC;IAC/B,OAAO,KAAK,CAAC,KAAK,KAAK,UAAU,IAAI,OAAO,IAAI,EAAE,OAAO,KAAK,QAAQ,CAAC;AACzE,CAAC"}
|
package/dist/types.d.ts
ADDED
|
@@ -0,0 +1,185 @@
|
|
|
1
|
+
import type { JsonObject, JsonValue, ServiceName } from "@faiber/sdk-core";
|
|
2
|
+
export type ManageProxyService = Exclude<ServiceName, "manage">;
|
|
3
|
+
export type ManageHttpMethod = "GET" | "POST" | "PUT" | "PATCH" | "DELETE";
|
|
4
|
+
export interface ManageModuleMeta extends JsonObject {
|
|
5
|
+
slug: string;
|
|
6
|
+
title: string;
|
|
7
|
+
category: string;
|
|
8
|
+
}
|
|
9
|
+
export interface ManageProjectSummary extends JsonObject {
|
|
10
|
+
slug: string;
|
|
11
|
+
name?: string;
|
|
12
|
+
domain?: string | null;
|
|
13
|
+
}
|
|
14
|
+
export interface ManageMeResponse extends JsonObject {
|
|
15
|
+
userId: string;
|
|
16
|
+
project: ManageProjectSummary;
|
|
17
|
+
enabledServices: string[];
|
|
18
|
+
modules: ManageModuleMeta[];
|
|
19
|
+
otherProjects: ManageProjectSummary[];
|
|
20
|
+
agenticUrl: string;
|
|
21
|
+
}
|
|
22
|
+
export interface ManageOkResponse extends JsonObject {
|
|
23
|
+
ok: boolean;
|
|
24
|
+
}
|
|
25
|
+
export interface ManageServiceHealthResponse extends JsonObject {
|
|
26
|
+
[service: string]: boolean;
|
|
27
|
+
}
|
|
28
|
+
export type ManageAgentThinkLevel = "low" | "medium" | "high";
|
|
29
|
+
export interface ManageAgentModelOption extends JsonObject {
|
|
30
|
+
id: string;
|
|
31
|
+
provider: string;
|
|
32
|
+
kind: "builtin";
|
|
33
|
+
}
|
|
34
|
+
export interface ManageAgentOllamaModelConfig extends JsonObject {
|
|
35
|
+
configurable: true;
|
|
36
|
+
base_url_env: "OLLAMA_BASE_URL";
|
|
37
|
+
default_model_env: "OLLAMA_MODEL";
|
|
38
|
+
think_level_env: "OLLAMA_THINK";
|
|
39
|
+
think_levels: ManageAgentThinkLevel[];
|
|
40
|
+
think_default_dev: "low";
|
|
41
|
+
}
|
|
42
|
+
export interface ManageAgentModelsResponse extends JsonObject {
|
|
43
|
+
cloud: ManageAgentModelOption[];
|
|
44
|
+
ollama: ManageAgentOllamaModelConfig;
|
|
45
|
+
}
|
|
46
|
+
export interface ManageDevLoginInput extends JsonObject {
|
|
47
|
+
username: string;
|
|
48
|
+
password: string;
|
|
49
|
+
}
|
|
50
|
+
export interface ManageImageUploadInput {
|
|
51
|
+
userId: string;
|
|
52
|
+
file: Blob;
|
|
53
|
+
scope: string;
|
|
54
|
+
fileName?: string;
|
|
55
|
+
}
|
|
56
|
+
export interface ManageImageLocation extends JsonObject {
|
|
57
|
+
url?: string;
|
|
58
|
+
}
|
|
59
|
+
export interface ManageImageUploadResponse extends JsonObject {
|
|
60
|
+
data?: ManageImageLocation;
|
|
61
|
+
url?: string;
|
|
62
|
+
}
|
|
63
|
+
export interface ManageAgentThreadInput extends JsonObject {
|
|
64
|
+
title: string;
|
|
65
|
+
ide_mode?: string;
|
|
66
|
+
}
|
|
67
|
+
export interface ManageAgentThreadResponse extends JsonObject {
|
|
68
|
+
id: string;
|
|
69
|
+
owner_user_id: string;
|
|
70
|
+
project_id: string | null;
|
|
71
|
+
project_slug: string;
|
|
72
|
+
ide_mode: "code" | "design";
|
|
73
|
+
title: string;
|
|
74
|
+
summary?: string | null;
|
|
75
|
+
event_sequence?: number;
|
|
76
|
+
active_agent_slug?: string | null;
|
|
77
|
+
context_revision?: number;
|
|
78
|
+
browser_url: string | null;
|
|
79
|
+
browser_title: string | null;
|
|
80
|
+
browser_active: boolean;
|
|
81
|
+
design_document: JsonValue | null;
|
|
82
|
+
created_at: string;
|
|
83
|
+
updated_at: string;
|
|
84
|
+
}
|
|
85
|
+
export interface ManageAgentMessage extends JsonObject {
|
|
86
|
+
id: string;
|
|
87
|
+
thread_id: string;
|
|
88
|
+
role: string;
|
|
89
|
+
content: string;
|
|
90
|
+
tool_calls?: JsonValue | null;
|
|
91
|
+
snapshot_id?: string | null;
|
|
92
|
+
changed_files?: string[];
|
|
93
|
+
created_at: string;
|
|
94
|
+
}
|
|
95
|
+
export interface ManageAgentCancelInput extends JsonObject {
|
|
96
|
+
client_message_id: string;
|
|
97
|
+
}
|
|
98
|
+
export interface ManageAgentCancelResponse extends JsonObject {
|
|
99
|
+
cancelled: boolean;
|
|
100
|
+
status: string;
|
|
101
|
+
run_id?: string;
|
|
102
|
+
cancelled_jobs?: number;
|
|
103
|
+
}
|
|
104
|
+
export interface ManageAgentChatInput extends JsonObject {
|
|
105
|
+
message: string;
|
|
106
|
+
client_message_id?: string;
|
|
107
|
+
surface?: JsonValue;
|
|
108
|
+
agent_slug?: string;
|
|
109
|
+
context?: JsonValue;
|
|
110
|
+
project_slug?: string;
|
|
111
|
+
selected_node_ids?: string[];
|
|
112
|
+
model_ref?: string;
|
|
113
|
+
}
|
|
114
|
+
export type ManageAgentFieldType = "text" | "textarea" | "number" | "email" | "url" | "date" | "datetime-local" | "checkbox" | "select" | "json";
|
|
115
|
+
export interface ManageAgentFieldOption extends JsonObject {
|
|
116
|
+
value: string;
|
|
117
|
+
label: string;
|
|
118
|
+
}
|
|
119
|
+
export interface ManageAgentFormField extends JsonObject {
|
|
120
|
+
key: string;
|
|
121
|
+
label?: string;
|
|
122
|
+
type?: ManageAgentFieldType;
|
|
123
|
+
required?: boolean;
|
|
124
|
+
placeholder?: string;
|
|
125
|
+
help?: string;
|
|
126
|
+
options?: ManageAgentFieldOption[];
|
|
127
|
+
}
|
|
128
|
+
export interface ManageAgentForm extends JsonObject {
|
|
129
|
+
fields?: ManageAgentFormField[];
|
|
130
|
+
}
|
|
131
|
+
export interface ManageAgentActionArguments extends JsonObject {
|
|
132
|
+
service?: ManageProxyService;
|
|
133
|
+
method?: ManageHttpMethod;
|
|
134
|
+
path?: string;
|
|
135
|
+
body?: JsonObject;
|
|
136
|
+
title?: string;
|
|
137
|
+
description?: string;
|
|
138
|
+
typescript?: string;
|
|
139
|
+
confirm?: string;
|
|
140
|
+
form?: ManageAgentForm;
|
|
141
|
+
}
|
|
142
|
+
export interface ManageAgentAction extends JsonObject {
|
|
143
|
+
action_id: string;
|
|
144
|
+
name: string;
|
|
145
|
+
arguments?: ManageAgentActionArguments;
|
|
146
|
+
}
|
|
147
|
+
export interface ManageAgentQuestion extends JsonObject {
|
|
148
|
+
ask_id: string;
|
|
149
|
+
question: string;
|
|
150
|
+
}
|
|
151
|
+
export interface ManageAgentComplete extends JsonObject {
|
|
152
|
+
message: string;
|
|
153
|
+
}
|
|
154
|
+
export interface ManageAgentActionCompletionInput extends JsonObject {
|
|
155
|
+
ok: boolean;
|
|
156
|
+
result: JsonValue;
|
|
157
|
+
error?: string;
|
|
158
|
+
}
|
|
159
|
+
export interface ManageAgentQuestionCompletionInput extends JsonObject {
|
|
160
|
+
answer: string;
|
|
161
|
+
}
|
|
162
|
+
export interface ManageServiceAction<TData extends JsonValue = JsonObject> {
|
|
163
|
+
service: ManageProxyService;
|
|
164
|
+
method: ManageHttpMethod;
|
|
165
|
+
path: string;
|
|
166
|
+
body?: TData;
|
|
167
|
+
}
|
|
168
|
+
export type ManageAgentStreamBody = ReadableStream<Uint8Array> | AsyncIterable<Uint8Array | string> | string;
|
|
169
|
+
export interface ManageAgentEvent<TData extends JsonValue | string = JsonValue | string> {
|
|
170
|
+
event: string;
|
|
171
|
+
data: TData;
|
|
172
|
+
id?: string;
|
|
173
|
+
retry?: number;
|
|
174
|
+
raw: string;
|
|
175
|
+
}
|
|
176
|
+
export interface ManageAgentActionEvent extends ManageAgentEvent<ManageAgentAction> {
|
|
177
|
+
event: "browser_action";
|
|
178
|
+
}
|
|
179
|
+
export interface ManageAgentQuestionEvent extends ManageAgentEvent<ManageAgentQuestion> {
|
|
180
|
+
event: "ask_user";
|
|
181
|
+
}
|
|
182
|
+
export interface ManageAgentCompleteEvent extends ManageAgentEvent<ManageAgentComplete> {
|
|
183
|
+
event: "complete";
|
|
184
|
+
}
|
|
185
|
+
//# sourceMappingURL=types.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../src/types.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EACV,UAAU,EACV,SAAS,EACT,WAAW,EACZ,MAAM,kBAAkB,CAAC;AAE1B,MAAM,MAAM,kBAAkB,GAAG,OAAO,CAAC,WAAW,EAAE,QAAQ,CAAC,CAAC;AAChE,MAAM,MAAM,gBAAgB,GAAG,KAAK,GAAG,MAAM,GAAG,KAAK,GAAG,OAAO,GAAG,QAAQ,CAAC;AAE3E,MAAM,WAAW,gB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MAAM,EAAE,MAAM,CAAC;CAChB;AAED,MAAM,WAAW,mBAAmB,CAAC,KAAK,SAAS,SAAS,GAAG,UAAU;IACvE,OAAO,EAAE,kBAAkB,CAAC;IAC5B,MAAM,EAAE,gBAAgB,CAAC;IACzB,IAAI,EAAE,MAAM,CAAC;IACb,IAAI,CAAC,EAAE,KAAK,CAAC;CACd;AAED,MAAM,MAAM,qBAAqB,GAC7B,cAAc,CAAC,UAAU,CAAC,GAC1B,aAAa,CAAC,UAAU,GAAG,MAAM,CAAC,GAClC,MAAM,CAAC;AAEX,MAAM,WAAW,gBAAgB,CAAC,KAAK,SAAS,SAAS,GAAG,MAAM,GAAG,SAAS,GAAG,MAAM;IACrF,KAAK,EAAE,MAAM,CAAC;IACd,IAAI,EAAE,KAAK,CAAC;IACZ,EAAE,CAAC,EAAE,MAAM,CAAC;IACZ,KAAK,CAAC,EAAE,MAAM,CAAC;IACf,GAAG,EAAE,MAAM,CAAC;CACb;AAED,MAAM,WAAW,sBAAuB,SAAQ,gBAAgB,CAAC,iBAAiB,CAAC;IACjF,KAAK,EAAE,gBAAgB,CAAC;CACzB;AAED,MAAM,WAAW,wBAAyB,SAAQ,gBAAgB,CAAC,mBAAmB,CAAC;IACrF,KAAK,EAAE,UAAU,CAAC;CACnB;AAED,MAAM,WAAW,wBAAyB,SAAQ,gBAAgB,CAAC,mBAAmB,CAAC;IACrF,KAAK,EAAE,UAAU,CAAC;CACnB"}
|
package/dist/types.js
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"types.js","sourceRoot":"","sources":["../src/types.ts"],"names":[],"mappings":""}
|
package/package.json
ADDED
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
{
|
|
2
|
+
"name": "@faiber/faiber-manage",
|
|
3
|
+
"version": "0.6.2",
|
|
4
|
+
"type": "module",
|
|
5
|
+
"sideEffects": false,
|
|
6
|
+
"main": "./dist/index.js",
|
|
7
|
+
"types": "./dist/index.d.ts",
|
|
8
|
+
"exports": {
|
|
9
|
+
".": {
|
|
10
|
+
"types": "./dist/index.d.ts",
|
|
11
|
+
"import": "./dist/index.js"
|
|
12
|
+
}
|
|
13
|
+
},
|
|
14
|
+
"files": [
|
|
15
|
+
"dist",
|
|
16
|
+
"README.md"
|
|
17
|
+
],
|
|
18
|
+
"dependencies": {
|
|
19
|
+
"@faiber/sdk-core": "0.6.2"
|
|
20
|
+
}
|
|
21
|
+
}
|