@major-tech/agents-client 0.1.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/client.d.ts +57 -0
- package/dist/client.d.ts.map +1 -0
- package/dist/errors.d.ts +35 -0
- package/dist/errors.d.ts.map +1 -0
- package/dist/index.cjs +248 -0
- package/dist/index.cjs.map +7 -0
- package/dist/index.d.ts +4 -0
- package/dist/index.d.ts.map +1 -0
- package/dist/index.js +225 -0
- package/dist/index.js.map +7 -0
- package/dist/next/auth.d.ts +14 -0
- package/dist/next/auth.d.ts.map +1 -0
- package/dist/next/index.cjs +268 -0
- package/dist/next/index.cjs.map +7 -0
- package/dist/next/index.d.ts +13 -0
- package/dist/next/index.d.ts.map +1 -0
- package/dist/next/index.js +245 -0
- package/dist/next/index.js.map +7 -0
- package/dist/types.d.ts +82 -0
- package/dist/types.d.ts.map +1 -0
- package/package.json +72 -0
package/dist/types.d.ts
ADDED
|
@@ -0,0 +1,82 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Configuration accepted by `createAgentsClient` / `new AgentsClient(...)`.
|
|
3
|
+
*
|
|
4
|
+
* In a deployed Major app every field has a sensible default sourced from
|
|
5
|
+
* platform-managed env vars and the Next.js request context.
|
|
6
|
+
*/
|
|
7
|
+
export interface AgentsClientConfig {
|
|
8
|
+
/** Base URL of the Major API. Defaults to `process.env.MAJOR_API_BASE_URL`. */
|
|
9
|
+
baseUrl?: string;
|
|
10
|
+
/**
|
|
11
|
+
* Deployment-identity JWT. Defaults to `process.env.MAJOR_JWT_TOKEN`. Sent as
|
|
12
|
+
* the `x-major-jwt` header on every request.
|
|
13
|
+
*/
|
|
14
|
+
majorJwtToken?: string;
|
|
15
|
+
/**
|
|
16
|
+
* Returns extra headers for each outbound call. The
|
|
17
|
+
* `@major-tech/agents-client/next` entry defaults this to lift
|
|
18
|
+
* `x-major-user-jwt` from the current request so per-user-OAuth agents work
|
|
19
|
+
* transparently. Override (e.g. return `{}`) outside a Next.js request scope.
|
|
20
|
+
*/
|
|
21
|
+
getHeaders?: () => Promise<Record<string, string>> | Record<string, string>;
|
|
22
|
+
/** Custom fetch implementation. Defaults to `globalThis.fetch`. */
|
|
23
|
+
fetch?: typeof fetch;
|
|
24
|
+
}
|
|
25
|
+
/**
|
|
26
|
+
* Request input for `AgentsClient.run`. Mirrors the body the Major API expects
|
|
27
|
+
* at `POST /agents/:agentId/runs`.
|
|
28
|
+
*/
|
|
29
|
+
export interface RunAgentRequest {
|
|
30
|
+
/** Stable id of the agent to invoke. */
|
|
31
|
+
agentId: string;
|
|
32
|
+
/** Prompt the agent should act on. */
|
|
33
|
+
prompt: string;
|
|
34
|
+
/** Optional human-readable name for the run. Shown in the Major UI. */
|
|
35
|
+
name?: string;
|
|
36
|
+
/** Optional description for the run. */
|
|
37
|
+
description?: string;
|
|
38
|
+
/** Optional structured context forwarded to the agent. */
|
|
39
|
+
payload?: Record<string, unknown>;
|
|
40
|
+
}
|
|
41
|
+
/** Successful response from `AgentsClient.run`. */
|
|
42
|
+
export interface RunAgentResponse {
|
|
43
|
+
/** Chat thread the run is associated with; also the `runId` for run-ops. */
|
|
44
|
+
chatThreadId: string;
|
|
45
|
+
/** Run lifecycle status. V1 only emits `"started"`. */
|
|
46
|
+
status: "started";
|
|
47
|
+
}
|
|
48
|
+
/** Response from `AgentsClient.sendMessage`. */
|
|
49
|
+
export interface SendMessageResponse {
|
|
50
|
+
/** The message was accepted and enqueued to the run. */
|
|
51
|
+
status: "queued";
|
|
52
|
+
}
|
|
53
|
+
/**
|
|
54
|
+
* Response from `AgentsClient.stopAgent`. Idempotent: stopping an
|
|
55
|
+
* already-finished run still reports `"stopped"`.
|
|
56
|
+
*/
|
|
57
|
+
export interface StopRunResponse {
|
|
58
|
+
status: "stopped";
|
|
59
|
+
}
|
|
60
|
+
/** A run started by this app, as returned by `getRunningInstancesOfAgent`. */
|
|
61
|
+
export interface AgentRun {
|
|
62
|
+
/** The run id (= chat thread id). */
|
|
63
|
+
runId: string;
|
|
64
|
+
/** Agent the run is executing. */
|
|
65
|
+
agentId: string;
|
|
66
|
+
/** Live status. Only currently-running runs are returned. */
|
|
67
|
+
status: "running";
|
|
68
|
+
/** ISO-8601 start time. */
|
|
69
|
+
startedAt: string;
|
|
70
|
+
}
|
|
71
|
+
/**
|
|
72
|
+
* One message in a run's thread, as returned by `getAgentContent`. Mirrors the
|
|
73
|
+
* Major chat-message envelope; `content` is left loose because its shape varies
|
|
74
|
+
* by `type` (`message` / `thinking` / `tool_use` / `tool_result` / ...).
|
|
75
|
+
*/
|
|
76
|
+
export interface AgentMessage {
|
|
77
|
+
role: "user" | "assistant" | "system";
|
|
78
|
+
type: string;
|
|
79
|
+
content: unknown;
|
|
80
|
+
timestamp: string;
|
|
81
|
+
}
|
|
82
|
+
//# sourceMappingURL=types.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../src/types.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AACH,MAAM,WAAW,kBAAkB;IACjC,+EAA+E;IAC/E,OAAO,CAAC,EAAE,MAAM,CAAC;IACjB;;;OAGG;IACH,aAAa,CAAC,EAAE,MAAM,CAAC;IACvB;;;;;OAKG;IACH,UAAU,CAAC,EAAE,MAAM,OAAO,CAAC,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,CAAC,GAAG,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,CAAC;IAC5E,mEAAmE;IACnE,KAAK,CAAC,EAAE,OAAO,KAAK,CAAC;CACtB;AAED;;;GAGG;AACH,MAAM,WAAW,eAAe;IAC9B,wCAAwC;IACxC,OAAO,EAAE,MAAM,CAAC;IAChB,sCAAsC;IACtC,MAAM,EAAE,MAAM,CAAC;IACf,uEAAuE;IACvE,IAAI,CAAC,EAAE,MAAM,CAAC;IACd,wCAAwC;IACxC,WAAW,CAAC,EAAE,MAAM,CAAC;IACrB,0DAA0D;IAC1D,OAAO,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAAC;CACnC;AAED,mDAAmD;AACnD,MAAM,WAAW,gBAAgB;IAC/B,4EAA4E;IAC5E,YAAY,EAAE,MAAM,CAAC;IACrB,uDAAuD;IACvD,MAAM,EAAE,SAAS,CAAC;CACnB;AAED,gDAAgD;AAChD,MAAM,WAAW,mBAAmB;IAClC,wDAAwD;IACxD,MAAM,EAAE,QAAQ,CAAC;CAClB;AAED;;;GAGG;AACH,MAAM,WAAW,eAAe;IAC9B,MAAM,EAAE,SAAS,CAAC;CACnB;AAED,8EAA8E;AAC9E,MAAM,WAAW,QAAQ;IACvB,qCAAqC;IACrC,KAAK,EAAE,MAAM,CAAC;IACd,kCAAkC;IAClC,OAAO,EAAE,MAAM,CAAC;IAChB,6DAA6D;IAC7D,MAAM,EAAE,SAAS,CAAC;IAClB,2BAA2B;IAC3B,SAAS,EAAE,MAAM,CAAC;CACnB;AAED;;;;GAIG;AACH,MAAM,WAAW,YAAY;IAC3B,IAAI,EAAE,MAAM,GAAG,WAAW,GAAG,QAAQ,CAAC;IACtC,IAAI,EAAE,MAAM,CAAC;IACb,OAAO,EAAE,OAAO,CAAC;IACjB,SAAS,EAAE,MAAM,CAAC;CACnB"}
|
package/package.json
ADDED
|
@@ -0,0 +1,72 @@
|
|
|
1
|
+
{
|
|
2
|
+
"name": "@major-tech/agents-client",
|
|
3
|
+
"version": "0.1.1",
|
|
4
|
+
"description": "TypeScript client for triggering and interacting with Major agents from a deployed Major app",
|
|
5
|
+
"type": "module",
|
|
6
|
+
"sideEffects": false,
|
|
7
|
+
"engines": {
|
|
8
|
+
"node": ">=18.0.0"
|
|
9
|
+
},
|
|
10
|
+
"files": [
|
|
11
|
+
"dist",
|
|
12
|
+
"README.md",
|
|
13
|
+
"LICENSE"
|
|
14
|
+
],
|
|
15
|
+
"exports": {
|
|
16
|
+
".": {
|
|
17
|
+
"types": "./dist/index.d.ts",
|
|
18
|
+
"import": "./dist/index.js",
|
|
19
|
+
"require": "./dist/index.cjs",
|
|
20
|
+
"default": "./dist/index.js"
|
|
21
|
+
},
|
|
22
|
+
"./next": {
|
|
23
|
+
"types": "./dist/next/index.d.ts",
|
|
24
|
+
"import": "./dist/next/index.js",
|
|
25
|
+
"require": "./dist/next/index.cjs",
|
|
26
|
+
"default": "./dist/next/index.js"
|
|
27
|
+
}
|
|
28
|
+
},
|
|
29
|
+
"main": "./dist/index.cjs",
|
|
30
|
+
"module": "./dist/index.js",
|
|
31
|
+
"types": "./dist/index.d.ts",
|
|
32
|
+
"scripts": {
|
|
33
|
+
"clean": "rm -rf dist",
|
|
34
|
+
"build": "pnpm clean && tsc && node scripts/build.mjs",
|
|
35
|
+
"typecheck": "tsc --noEmit",
|
|
36
|
+
"prepublishOnly": "pnpm run typecheck && pnpm run build"
|
|
37
|
+
},
|
|
38
|
+
"keywords": [
|
|
39
|
+
"major",
|
|
40
|
+
"agents",
|
|
41
|
+
"client"
|
|
42
|
+
],
|
|
43
|
+
"author": "Major Technology",
|
|
44
|
+
"license": "MIT",
|
|
45
|
+
"repository": {
|
|
46
|
+
"type": "git",
|
|
47
|
+
"url": "https://github.com/major-technology/public-packages.git",
|
|
48
|
+
"directory": "agents-client"
|
|
49
|
+
},
|
|
50
|
+
"homepage": "https://github.com/major-technology/public-packages/tree/main/agents-client#readme",
|
|
51
|
+
"bugs": {
|
|
52
|
+
"url": "https://github.com/major-technology/public-packages/issues"
|
|
53
|
+
},
|
|
54
|
+
"publishConfig": {
|
|
55
|
+
"access": "public"
|
|
56
|
+
},
|
|
57
|
+
"devDependencies": {
|
|
58
|
+
"@types/node": "^22.0.0",
|
|
59
|
+
"esbuild": "^0.24.0",
|
|
60
|
+
"next": "^14.0.0",
|
|
61
|
+
"react": "^18.0.0",
|
|
62
|
+
"typescript": "^5.9.3"
|
|
63
|
+
},
|
|
64
|
+
"peerDependencies": {
|
|
65
|
+
"next": ">=14.0.0"
|
|
66
|
+
},
|
|
67
|
+
"peerDependenciesMeta": {
|
|
68
|
+
"next": {
|
|
69
|
+
"optional": true
|
|
70
|
+
}
|
|
71
|
+
}
|
|
72
|
+
}
|