@adonis-agora/agent 0.94.0 → 0.96.0
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/CHANGELOG.md +16 -0
- package/dist/assets/spa/assets/{index-DUq09Q_k.js → index-DBu17cDY.js} +1 -1
- package/dist/assets/spa/index.html +1 -1
- package/dist/providers/poppy_connections_provider.d.ts +1 -1
- package/dist/providers/poppy_connections_provider.js +1 -1
- package/dist/providers/poppy_provider.d.ts +1 -1
- package/dist/providers/poppy_provider.d.ts.map +1 -1
- package/dist/providers/poppy_provider.js +6 -6
- package/dist/providers/poppy_provider.js.map +1 -1
- package/dist/src/index.d.ts +1 -1
- package/dist/src/index.js +1 -1
- package/dist/src/mcp/auth.d.ts +3 -3
- package/dist/src/mcp/auth.d.ts.map +1 -1
- package/dist/src/mcp/auth.js +2 -29
- package/dist/src/mcp/auth.js.map +1 -1
- package/dist/src/mcp/discovery.d.ts +3 -3
- package/dist/src/mcp/discovery.d.ts.map +1 -1
- package/dist/src/mcp/discovery.js +2 -2
- package/dist/src/poppy/auth.d.ts +20 -16
- package/dist/src/poppy/auth.d.ts.map +1 -1
- package/dist/src/poppy/auth.js.map +1 -1
- package/dist/src/poppy/conversations.d.ts +25 -25
- package/dist/src/poppy/conversations.d.ts.map +1 -1
- package/dist/src/poppy/conversations.js +37 -37
- package/dist/src/poppy/conversations.js.map +1 -1
- package/dist/src/poppy/define_config.d.ts +7 -7
- package/dist/src/poppy/define_config.d.ts.map +1 -1
- package/dist/src/poppy/define_config.js +1 -1
- package/dist/src/poppy/endpoints.d.ts +2 -2
- package/dist/src/poppy/endpoints.js +1 -1
- package/dist/src/poppy/handler.d.ts +5 -5
- package/dist/src/poppy/handler.d.ts.map +1 -1
- package/dist/src/poppy/handler.js +23 -21
- package/dist/src/poppy/handler.js.map +1 -1
- package/dist/src/poppy/index.d.ts +2 -2
- package/dist/src/poppy/index.d.ts.map +1 -1
- package/dist/src/poppy/index.js +1 -1
- package/dist/src/poppy/index.js.map +1 -1
- package/dist/src/poppy/protocol.d.ts +30 -23
- package/dist/src/poppy/protocol.d.ts.map +1 -1
- package/dist/src/poppy/protocol.js +16 -17
- package/dist/src/poppy/protocol.js.map +1 -1
- package/dist/src/poppy/redis-store.d.ts +1 -1
- package/dist/src/poppy/redis-store.js +1 -1
- package/dist/src/poppy/store.d.ts +7 -7
- package/dist/src/poppy/store.js +1 -1
- package/dist/src/poppy-client/api.d.ts +5 -4
- package/dist/src/poppy-client/api.d.ts.map +1 -1
- package/dist/src/poppy-client/api.js +14 -9
- package/dist/src/poppy-client/api.js.map +1 -1
- package/dist/src/poppy-client/browser.d.ts +12 -18
- package/dist/src/poppy-client/browser.d.ts.map +1 -1
- package/dist/src/poppy-client/browser.js +33 -73
- package/dist/src/poppy-client/browser.js.map +1 -1
- package/dist/src/poppy-client/cli/main.d.ts.map +1 -1
- package/dist/src/poppy-client/cli/main.js +48 -56
- package/dist/src/poppy-client/cli/main.js.map +1 -1
- package/dist/src/poppy-client/company.d.ts +43 -28
- package/dist/src/poppy-client/company.d.ts.map +1 -1
- package/dist/src/poppy-client/company.js +216 -160
- package/dist/src/poppy-client/company.js.map +1 -1
- package/dist/src/poppy-client/conversations.d.ts +12 -13
- package/dist/src/poppy-client/conversations.d.ts.map +1 -1
- package/dist/src/poppy-client/conversations.js +24 -22
- package/dist/src/poppy-client/conversations.js.map +1 -1
- package/dist/src/poppy-client/discovery.d.ts +32 -10
- package/dist/src/poppy-client/discovery.d.ts.map +1 -1
- package/dist/src/poppy-client/discovery.js +134 -68
- package/dist/src/poppy-client/discovery.js.map +1 -1
- package/dist/src/poppy-client/dpop.d.ts +2 -1
- package/dist/src/poppy-client/dpop.d.ts.map +1 -1
- package/dist/src/poppy-client/dpop.js +2 -1
- package/dist/src/poppy-client/dpop.js.map +1 -1
- package/dist/src/poppy-client/errors.d.ts +5 -4
- package/dist/src/poppy-client/errors.d.ts.map +1 -1
- package/dist/src/poppy-client/errors.js +5 -4
- package/dist/src/poppy-client/errors.js.map +1 -1
- package/dist/src/poppy-client/http.d.ts +4 -2
- package/dist/src/poppy-client/http.d.ts.map +1 -1
- package/dist/src/poppy-client/http.js +9 -5
- package/dist/src/poppy-client/http.js.map +1 -1
- package/dist/src/poppy-client/identity.d.ts +15 -15
- package/dist/src/poppy-client/identity.d.ts.map +1 -1
- package/dist/src/poppy-client/identity.js +17 -33
- package/dist/src/poppy-client/identity.js.map +1 -1
- package/dist/src/poppy-client/index.d.ts +6 -3
- package/dist/src/poppy-client/index.d.ts.map +1 -1
- package/dist/src/poppy-client/index.js +6 -3
- package/dist/src/poppy-client/index.js.map +1 -1
- package/dist/src/poppy-client/llm.js +4 -4
- package/dist/src/poppy-client/llm.js.map +1 -1
- package/dist/src/poppy-client/mcp.d.ts +3 -4
- package/dist/src/poppy-client/mcp.d.ts.map +1 -1
- package/dist/src/poppy-client/mcp.js +26 -38
- package/dist/src/poppy-client/mcp.js.map +1 -1
- package/dist/src/poppy-client/safe_fetch.d.ts +30 -0
- package/dist/src/poppy-client/safe_fetch.d.ts.map +1 -0
- package/dist/src/poppy-client/safe_fetch.js +210 -0
- package/dist/src/poppy-client/safe_fetch.js.map +1 -0
- package/dist/src/poppy-client/session_jwt.d.ts +20 -0
- package/dist/src/poppy-client/session_jwt.d.ts.map +1 -0
- package/dist/src/poppy-client/session_jwt.js +37 -0
- package/dist/src/poppy-client/session_jwt.js.map +1 -0
- package/dist/src/poppy-client/signin.d.ts +34 -11
- package/dist/src/poppy-client/signin.d.ts.map +1 -1
- package/dist/src/poppy-client/signin.js +134 -80
- package/dist/src/poppy-client/signin.js.map +1 -1
- package/dist/src/poppy-client/store.d.ts +23 -11
- package/dist/src/poppy-client/store.d.ts.map +1 -1
- package/dist/src/poppy-client/store.js +1 -1
- package/dist/src/poppy-client/store.js.map +1 -1
- package/dist/src/poppy-client/task_coverage.d.ts +13 -0
- package/dist/src/poppy-client/task_coverage.d.ts.map +1 -0
- package/dist/src/poppy-client/task_coverage.js +66 -0
- package/dist/src/poppy-client/task_coverage.js.map +1 -0
- package/dist/src/poppy-client/token_client.d.ts +36 -33
- package/dist/src/poppy-client/token_client.d.ts.map +1 -1
- package/dist/src/poppy-client/token_client.js +47 -47
- package/dist/src/poppy-client/token_client.js.map +1 -1
- package/dist/src/poppy-client/types.d.ts +81 -42
- package/dist/src/poppy-client/types.d.ts.map +1 -1
- package/dist/src/poppy-client/types.js +1 -1
- package/dist/src/poppy-client/util.d.ts +12 -3
- package/dist/src/poppy-client/util.d.ts.map +1 -1
- package/dist/src/poppy-client/util.js +29 -9
- package/dist/src/poppy-client/util.js.map +1 -1
- package/dist/src/poppy-connections/config.d.ts +2 -2
- package/dist/src/poppy-connections/config.js +1 -1
- package/dist/src/poppy-connections/config.js.map +1 -1
- package/dist/src/poppy-connections/crypto.d.ts +2 -2
- package/dist/src/poppy-connections/crypto.js +2 -2
- package/dist/src/poppy-connections/index.d.ts +1 -1
- package/dist/src/poppy-connections/index.js +1 -1
- package/dist/src/poppy-connections/service.d.ts +11 -10
- package/dist/src/poppy-connections/service.d.ts.map +1 -1
- package/dist/src/poppy-connections/service.js +33 -21
- package/dist/src/poppy-connections/service.js.map +1 -1
- package/dist/src/poppy-connections/store.d.ts +2 -2
- package/dist/src/poppy-connections/tools.d.ts.map +1 -1
- package/dist/src/poppy-connections/tools.js +5 -4
- package/dist/src/poppy-connections/tools.js.map +1 -1
- package/dist/src/rag/index.d.ts +1 -0
- package/dist/src/rag/index.d.ts.map +1 -1
- package/dist/src/rag/index.js +1 -0
- package/dist/src/rag/index.js.map +1 -1
- package/dist/src/rag/pg-vector-store.d.ts +8 -0
- package/dist/src/rag/pg-vector-store.d.ts.map +1 -1
- package/dist/src/rag/pg-vector-store.js +14 -5
- package/dist/src/rag/pg-vector-store.js.map +1 -1
- package/dist/src/rag/with-rag.d.ts +75 -0
- package/dist/src/rag/with-rag.d.ts.map +1 -0
- package/dist/src/rag/with-rag.js +132 -0
- package/dist/src/rag/with-rag.js.map +1 -0
- package/package.json +9 -9
- package/skills/agent-governance/SKILL.md +3 -3
- package/skills/agent-tools/SKILL.md +3 -3
|
@@ -10,7 +10,7 @@
|
|
|
10
10
|
rel="stylesheet"
|
|
11
11
|
/>
|
|
12
12
|
<title>agent · governance console</title>
|
|
13
|
-
<script type="module" crossorigin src="./assets/index-
|
|
13
|
+
<script type="module" crossorigin src="./assets/index-DBu17cDY.js"></script>
|
|
14
14
|
<link rel="stylesheet" crossorigin href="./assets/index-BxmGk7Ik.css">
|
|
15
15
|
</head>
|
|
16
16
|
<body>
|
|
@@ -4,7 +4,7 @@ import type { ApplicationService } from '@adonisjs/core/types';
|
|
|
4
4
|
* the agent identity routes, the connect pages and callback, the `poppy_*` tools, and — when the
|
|
5
5
|
* config has `api` — `GET/DELETE {path}/api/connections` for the app's own settings UI.
|
|
6
6
|
*
|
|
7
|
-
* @experimental Tracks Personal Agent Protocol Draft 0.
|
|
7
|
+
* @experimental Tracks Personal Agent Protocol Draft 0.3 — will change as the spec evolves.
|
|
8
8
|
*/
|
|
9
9
|
export default class PoppyConnectionsProvider {
|
|
10
10
|
#private;
|
|
@@ -20,7 +20,7 @@ function configOf(app) {
|
|
|
20
20
|
* the agent identity routes, the connect pages and callback, the `poppy_*` tools, and — when the
|
|
21
21
|
* config has `api` — `GET/DELETE {path}/api/connections` for the app's own settings UI.
|
|
22
22
|
*
|
|
23
|
-
* @experimental Tracks Personal Agent Protocol Draft 0.
|
|
23
|
+
* @experimental Tracks Personal Agent Protocol Draft 0.3 — will change as the spec evolves.
|
|
24
24
|
*/
|
|
25
25
|
export default class PoppyConnectionsProvider {
|
|
26
26
|
app;
|
|
@@ -5,7 +5,7 @@ export default class PoppyProvider {
|
|
|
5
5
|
constructor(app: ApplicationService);
|
|
6
6
|
register(): void;
|
|
7
7
|
boot(): Promise<void>;
|
|
8
|
-
/** Warn, once the app is up, when no one can verify a Session
|
|
8
|
+
/** Warn, once the app is up, when no one can verify a Session header: every request is a 501. */
|
|
9
9
|
ready(): Promise<void>;
|
|
10
10
|
shutdown(): Promise<void>;
|
|
11
11
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"poppy_provider.d.ts","sourceRoot":"","sources":["../../providers/poppy_provider.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,kBAAkB,EAAE,MAAM,sBAAsB,CAAC;AA2C/D,MAAM,CAAC,OAAO,OAAO,aAAa;;IAGpB,SAAS,CAAC,GAAG,EAAE,kBAAkB;IAA7C,YAAsB,GAAG,EAAE,kBAAkB,EAAI;IAEjD,QAAQ,SAIP;IAEK,IAAI,kBAgCT;IAED,
|
|
1
|
+
{"version":3,"file":"poppy_provider.d.ts","sourceRoot":"","sources":["../../providers/poppy_provider.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,kBAAkB,EAAE,MAAM,sBAAsB,CAAC;AA2C/D,MAAM,CAAC,OAAO,OAAO,aAAa;;IAGpB,SAAS,CAAC,GAAG,EAAE,kBAAkB;IAA7C,YAAsB,GAAG,EAAE,kBAAkB,EAAI;IAEjD,QAAQ,SAIP;IAEK,IAAI,kBAgCT;IAED,iGAAiG;IAC3F,KAAK,kBAOV;IAEK,QAAQ,kBAGb;CAsEF"}
|
|
@@ -7,8 +7,8 @@ import { setPoppyHandler } from '../src/poppy/runtime.js';
|
|
|
7
7
|
import { InMemoryPoppyStore, LucidPoppyStore } from '../src/poppy/store.js';
|
|
8
8
|
import { ToolRegistry } from '../src/tool-registry.js';
|
|
9
9
|
/**
|
|
10
|
-
* Exposes a registered agent as the Company Agent of Personal Agent Protocol ("Poppy", Draft 0.
|
|
11
|
-
* conversations (§
|
|
10
|
+
* Exposes a registered agent as the Company Agent of Personal Agent Protocol ("Poppy", Draft 0.3)
|
|
11
|
+
* conversations (§8). Reads `config/poppy.ts` and answers, under its `path`:
|
|
12
12
|
*
|
|
13
13
|
* - `POST {path}` — start a conversation (or a Direct Conversation) with its first message;
|
|
14
14
|
* - `POST {path}/{id}/messages` — another message;
|
|
@@ -16,11 +16,11 @@ import { ToolRegistry } from '../src/tool-registry.js';
|
|
|
16
16
|
* - `POST {path}/{id}/handoff`, `POST {path}/{id}/close`.
|
|
17
17
|
*
|
|
18
18
|
* Mounted as SERVER middleware, ahead of the router, like the A2A surface: requests are
|
|
19
|
-
* authenticated by their Session
|
|
19
|
+
* authenticated by their Session header before the body is read, and never reach the bodyparser,
|
|
20
20
|
* session or CSRF. `PoppyConversations` is bound in the container — the app drives the Company
|
|
21
21
|
* side through it (a person joining, `user_requested`).
|
|
22
22
|
*
|
|
23
|
-
* @experimental Tracks Personal Agent Protocol Draft 0.
|
|
23
|
+
* @experimental Tracks Personal Agent Protocol Draft 0.3 (https://personalagentprotocol.org/docs/spec),
|
|
24
24
|
* a spec still in development: this API WILL change as the spec evolves — possibly in breaking
|
|
25
25
|
* ways, outside semver majors while it is a draft.
|
|
26
26
|
*/
|
|
@@ -79,13 +79,13 @@ export default class PoppyProvider {
|
|
|
79
79
|
return (await built)(ctx);
|
|
80
80
|
});
|
|
81
81
|
}
|
|
82
|
-
/** Warn, once the app is up, when no one can verify a Session
|
|
82
|
+
/** Warn, once the app is up, when no one can verify a Session header: every request is a 501. */
|
|
83
83
|
async ready() {
|
|
84
84
|
const config = poppyConfigOf(this.app);
|
|
85
85
|
if (!config || config.authenticate !== undefined || globalPoppyAuthenticate())
|
|
86
86
|
return;
|
|
87
87
|
const logger = await this.app.container.make('logger');
|
|
88
|
-
logger.warn('poppy: no Session
|
|
88
|
+
logger.warn('poppy: no Session header resolver — install @adonis-agora/authkit-server with Poppy enabled, or set `authenticate` in config/poppy.ts. Until then the endpoint answers 501.');
|
|
89
89
|
}
|
|
90
90
|
async shutdown() {
|
|
91
91
|
setPoppyHandler(null);
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"poppy_provider.js","sourceRoot":"","sources":["../../providers/poppy_provider.ts"],"names":[],"mappings":"AAEA,OAAO,EAAE,YAAY,EAAE,MAAM,yB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AAC,KAAK,IAAI,OAAO,CAAC;QACtC,IAAI,OAAO,KAAK,KAAK,QAAQ;YAAE,OAAO,KAAK,CAAC;QAC5C,IAAI,KAAK,KAAK,QAAQ;YAAE,OAAO,IAAI,kBAAkB,EAAE,CAAC;QACxD,MAAM,EAAE,GAAG,CAAC,MAAM,IAAI,CAAC,GAAG,CAAC,SAAS,CAAC,IAAI,CAAC,UAAmB,CAAC,CAE7D,CAAC;QACF,MAAM,KAAK,GAAG,IAAI,eAAe,CAAC,EAAE,CAAC,UAAU,CAAC,MAAM,CAAC,UAAU,CAAC,EAAE;YAClE,GAAG,CAAC,MAAM,CAAC,gBAAgB,KAAK,SAAS;gBACvC,CAAC,CAAC,EAAE,gBAAgB,EAAE,MAAM,CAAC,gBAAgB,EAAE;gBAC/C,CAAC,CAAC,EAAE,CAAC;SACR,CAAC,CAAC;QACH,MAAM,KAAK,CAAC,KAAK,EAAE,CAAC;QACpB,OAAO,KAAK,CAAC;IACf,CAAC;CACF"}
|
package/dist/src/index.d.ts
CHANGED
|
@@ -8,7 +8,7 @@ export * from './action-proposal-text.js';
|
|
|
8
8
|
export * from './action-proposal-worker.js';
|
|
9
9
|
export * from './spi/action-proposal-outcome-store.js';
|
|
10
10
|
export * from './spi/background-actor-resolver.js';
|
|
11
|
-
export declare const VERSION = "0.
|
|
11
|
+
export declare const VERSION = "0.96.0";
|
|
12
12
|
export { configure } from '../configure.js';
|
|
13
13
|
export * from './action-proposal-discovery.js';
|
|
14
14
|
export { prepareActionProposal } from './action-proposal-preparation.js';
|
package/dist/src/index.js
CHANGED
|
@@ -8,7 +8,7 @@ export * from './action-proposal-text.js';
|
|
|
8
8
|
export * from './action-proposal-worker.js';
|
|
9
9
|
export * from './spi/action-proposal-outcome-store.js';
|
|
10
10
|
export * from './spi/background-actor-resolver.js';
|
|
11
|
-
export const VERSION = '0.
|
|
11
|
+
export const VERSION = '0.96.0';
|
|
12
12
|
// Re-export the configure hook from the package root so `node ace configure` finds it.
|
|
13
13
|
// AdonisJS imports the package MAIN and reads `configure` off the module namespace —
|
|
14
14
|
// the `./configure` subpath alone is never consulted.
|
package/dist/src/mcp/auth.d.ts
CHANGED
|
@@ -95,7 +95,7 @@ export declare class McpAuthError extends Error {
|
|
|
95
95
|
readonly status: 401 | 403;
|
|
96
96
|
/**
|
|
97
97
|
* The `WWW-Authenticate` error code, when not the status' default (`invalid_token` for 401,
|
|
98
|
-
* `insufficient_scope` for 403)
|
|
98
|
+
* `insufficient_scope` for 403).
|
|
99
99
|
*/
|
|
100
100
|
readonly error?: McpChallengeError;
|
|
101
101
|
constructor(message: string, options?: {
|
|
@@ -105,7 +105,7 @@ export declare class McpAuthError extends Error {
|
|
|
105
105
|
});
|
|
106
106
|
}
|
|
107
107
|
/** Error codes the MCP endpoint can put in its `WWW-Authenticate` challenge. */
|
|
108
|
-
export type McpChallengeError = 'invalid_token' | 'insufficient_scope'
|
|
108
|
+
export type McpChallengeError = 'invalid_token' | 'insufficient_scope';
|
|
109
109
|
/**
|
|
110
110
|
* A configured MCP auth strategy, as a lazy thunk the provider calls at boot. Each factory lazily
|
|
111
111
|
* imports / resolves its peer inside the thunk, so nothing loads until the strategy is actually selected.
|
|
@@ -115,7 +115,7 @@ export type McpAuthFactory = (ctx: McpAuthContext) => McpAuth | Promise<McpAuth>
|
|
|
115
115
|
* Resolve a `McpAuth` config value (a ready instance or a lazy factory) at provider boot.
|
|
116
116
|
*/
|
|
117
117
|
export declare function resolveMcpAuth(auth: McpAuth | McpAuthFactory, ctx: McpAuthContext): Promise<McpAuth>;
|
|
118
|
-
/** The `gty` authkit-server gives the access tokens it mints for a Poppy
|
|
118
|
+
/** The `gty` authkit-server gives the access tokens it mints for a Poppy sign-in (§7, MCP). */
|
|
119
119
|
export declare const POPPY_GRANT_TYPE = "poppy";
|
|
120
120
|
/**
|
|
121
121
|
* The organization authkit bound to a grant at consent time (the active org of the session that
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"auth.d.ts","sourceR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;;;;;;;;GASG;AACH,wBAAgB,WAAW,CAAC,OAAO,GAAE,qBAA0B,GAAG,cAAc,CAwF/E;AAsCD,oFAAoF;AACpF,MAAM,MAAM,mBAAmB,GAAG,CAAC,MAAM,EAAE,MAAM,KAAK,KAAK,GAAG,OAAO,CAAC,KAAK,CAAC,CAAC;AAE7E,sCAAsC;AACtC,MAAM,WAAW,oBAAoB;IACnC,wEAAwE;IACxE,OAAO,EAAE,MAAM,EAAE,CAAC;IAClB,yFAAyF;IACzF,OAAO,CAAC,EAAE,mBAAmB,CAAC;CAC/B;AAED;;;;GAIG;AACH,wBAAgB,UAAU,CAAC,OAAO,EAAE,oBAAoB,GAAG,cAAc,CAcxE;AAcD;;;;;;;;;;;;;;;;;;GAkBG;AACH,wBAAgB,KAAK,CAAC,GAAG,UAAU,EAAE,KAAK,CAAC,OAAO,GAAG,cAAc,CAAC,GAAG,cAAc,CAuBpF"}
|
package/dist/src/mcp/auth.js
CHANGED
|
@@ -1,6 +1,5 @@
|
|
|
1
1
|
import { scopeRole } from '../a2a/gate.js';
|
|
2
2
|
import { PERSONAL_AGENT_ROLE } from '../a2a/permission-tool.js';
|
|
3
|
-
import { globalPoppyAuthenticate } from '../poppy/auth.js';
|
|
4
3
|
/**
|
|
5
4
|
* A typed refusal from an MCP auth strategy: the token was recognized and deliberately refused (a
|
|
6
5
|
* client that is not allowed on this endpoint, an account that left the tenant, a revoked grant).
|
|
@@ -27,7 +26,7 @@ export class McpAuthError extends Error {
|
|
|
27
26
|
status;
|
|
28
27
|
/**
|
|
29
28
|
* The `WWW-Authenticate` error code, when not the status' default (`invalid_token` for 401,
|
|
30
|
-
* `insufficient_scope` for 403)
|
|
29
|
+
* `insufficient_scope` for 403).
|
|
31
30
|
*/
|
|
32
31
|
error;
|
|
33
32
|
constructor(message, options = {}) {
|
|
@@ -47,7 +46,7 @@ export async function resolveMcpAuth(auth, ctx) {
|
|
|
47
46
|
}
|
|
48
47
|
return auth;
|
|
49
48
|
}
|
|
50
|
-
/** The `gty` authkit-server gives the access tokens it mints for a Poppy
|
|
49
|
+
/** The `gty` authkit-server gives the access tokens it mints for a Poppy sign-in (§7, MCP). */
|
|
51
50
|
export const POPPY_GRANT_TYPE = 'poppy';
|
|
52
51
|
/**
|
|
53
52
|
* Authenticate MCP clients with `@adonis-agora/authkit-server`: verifies the bearer token against the
|
|
@@ -85,15 +84,6 @@ export function authKitAuth(options = {}) {
|
|
|
85
84
|
const service = await getService();
|
|
86
85
|
const at = await service.provider.AccessToken.find(token);
|
|
87
86
|
if (!at) {
|
|
88
|
-
// A signed-out Poppy Session's MCP token lives only in authkit's Poppy store: it is valid,
|
|
89
|
-
// but this server needs an account — Poppy's `sign_in_required` (§4.3), not `invalid_token`
|
|
90
|
-
// (which would only make the agent mint the same kind of token again).
|
|
91
|
-
if (context !== undefined && (await isSignedOutPoppyToken(token, context.resource))) {
|
|
92
|
-
throw new McpAuthError('sign in to use this server', {
|
|
93
|
-
status: 403,
|
|
94
|
-
error: 'sign_in_required',
|
|
95
|
-
});
|
|
96
|
-
}
|
|
97
87
|
// Not an access token this issuer knows — plain `Error`, so `anyOf` tries the next strategy.
|
|
98
88
|
throw new Error('invalid or expired access token');
|
|
99
89
|
}
|
|
@@ -151,23 +141,6 @@ export function authKitAuth(options = {}) {
|
|
|
151
141
|
};
|
|
152
142
|
};
|
|
153
143
|
}
|
|
154
|
-
/** A Bearer token authkit issued for `resource` to a Poppy Session that is not signed in. */
|
|
155
|
-
async function isSignedOutPoppyToken(token, resource) {
|
|
156
|
-
const authenticate = globalPoppyAuthenticate();
|
|
157
|
-
if (authenticate === undefined)
|
|
158
|
-
return false;
|
|
159
|
-
try {
|
|
160
|
-
const result = await authenticate({
|
|
161
|
-
method: 'POST',
|
|
162
|
-
url: resource,
|
|
163
|
-
headers: { authorization: `Bearer ${token}` },
|
|
164
|
-
});
|
|
165
|
-
return result.ok && !result.principal.signedIn;
|
|
166
|
-
}
|
|
167
|
-
catch {
|
|
168
|
-
return false;
|
|
169
|
-
}
|
|
170
|
-
}
|
|
171
144
|
/** Whether a token's `aud` names `resource` (a trailing slash on either side is tolerated). */
|
|
172
145
|
function audienceNames(aud, resource) {
|
|
173
146
|
const trim = (value) => value.replace(/\/+$/, '');
|
package/dist/src/mcp/auth.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"auth.js","sourceRoot":"","sources":["../../../src/mcp/auth.ts"],"names":[],"mappings":"AAEA,OAAO,EAAE,SAAS,EAAE,MAAM,gBAAgB,CAAC;AAC3C,OAAO,EAAE,mBAAmB,EAAE,MAAM,2BAA2B,CAAC;
|
|
1
|
+
{"version":3,"file":"auth.js","sourceRoot":"","sources":["../../../src/mcp/auth.ts"],"names":[],"mappings":"AAEA,OAAO,EAAE,SAAS,EAAE,MAAM,gBAAgB,CAAC;AAC3C,OAAO,EAAE,mBAAmB,EAAE,MAAM,2BAA2B,CAAC;AA8EhE;;;;;;;;;;;;;;;;;;;;GAoBG;AACH,MAAM,OAAO,YAAa,SAAQ,KAAK;IACrC,mHAAmH;IAC1G,MAAM,CAAY;IAC3B;;;OAGG;IACM,KAAK,CAAqB;IAEnC,YACE,OAAe,EACf,OAAO,GAAuE,EAAE;QAEhF,KAAK,CAAC,OAAO,EAAE,OAAO,CAAC,KAAK,KAAK,SAAS,CAAC,CAAC,CAAC,EAAE,KAAK,EAAE,OAAO,CAAC,KAAK,EAAE,CAAC,CAAC,CAAC,SAAS,CAAC,CAAC;QACnF,IAAI,CAAC,IAAI,GAAG,cAAc,CAAC;QAC3B,IAAI,CAAC,MAAM,GAAG,OAAO,CAAC,MAAM,IAAI,GAAG,CAAC;QACpC,IAAI,OAAO,CAAC,KAAK,KAAK,SAAS;YAAE,IAAI,CAAC,KAAK,GAAG,OAAO,CAAC,KAAK,CAAC;IAC9D,CAAC;CACF;AAWD;;GAEG;AACH,MAAM,CAAC,KAAK,UAAU,cAAc,CAClC,IAA8B,EAC9B,GAAmB;IAEnB,IAAI,OAAO,IA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/poppy:issuer')`
|
|
32
|
-
* when Personal Agent Protocol is on — Poppy §
|
|
33
|
-
* to include it, so a Poppy
|
|
32
|
+
* when Personal Agent Protocol is on — Poppy §7 requires a listed MCP server's `authorization_servers`
|
|
33
|
+
* to include it, so a Poppy access token's issuer is one this server names.
|
|
34
34
|
*/
|
|
35
35
|
export declare function announcedPoppyIssuer(): string | undefined;
|
|
36
36
|
/**
|
|
@@ -44,7 +44,7 @@ export interface WwwAuthenticateOptions {
|
|
|
44
44
|
* The RFC 6750 error code. `invalid_token` when the request carried a token that was refused,
|
|
45
45
|
* `insufficient_scope` for a `403`, omitted when no token was sent at all (RFC 6750 §3.1).
|
|
46
46
|
*/
|
|
47
|
-
error?: 'invalid_token' | 'insufficient_scope'
|
|
47
|
+
error?: 'invalid_token' | 'insufficient_scope';
|
|
48
48
|
/** The metadata URL (RFC 9728 §5.1). Set only when the auth strategy exposes OAuth metadata. */
|
|
49
49
|
resourceMetadataUrl?: string;
|
|
50
50
|
/** With `insufficient_scope`: the scopes the request needs (RFC 6750 §3), space-separated. */
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"discovery.d.ts","sourceRoot":"","sources":["../../../src/mcp/discovery.ts"],"names":[],"mappings":"AAAA;;;;;;;GAOG;AAEH,OAAO,KAAK,EAAE,gBAAgB,EAAE,MAAM,WAAW,CAAC;AAElD,4FAA4F;AAC5F,wBAAgB,gBAAgB,CAAC,IAAI,EAAE,MAAM,GAAG,SAAS,GAAG,MAAM,CAEjE;AAED;;;;GAIG;AACH,wBAAgB,YAAY,CAAC,SAAS,EAAE,MAAM,GAAG,MAAM,CAoBtD;AAED,yHAAyH;AACzH,wBAAgB,cAAc,CAAC,MAAM,EAAE,MAAM,EAAE,IAAI,EAAE,MAAM,GAAG,MAAM,CAEnE;AAED,sHAAsH;AACtH,wBAAgB,4BAA4B,CAAC,MAAM,EAAE,MAAM,EAAE,IAAI,EAAE,MAAM,GAAG,MAAM,CAEjF;AAED,yDAAyD;A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C,aAAa,EAAE,MAAM,CAAC;CACvB;AAED;;;;GAIG;AACH,wBAAgB,oBAAoB,IAAI,MAAM,GAAG,SAAS,CAGzD;AAED;;;GAGG;AACH,wBAAgB,yBAAyB,CACvC,IAAI,EAAE,gBAAgB,EACtB,MAAM,EAAE,MAAM,EACd,IAAI,EAAE,MAAM,GACX,yBAAyB,CAS3B;AAED,oDAAoD;AACpD,MAAM,WAAW,sBAAsB;IACrC;;;OAGG;IACH,KAAK,CAAC,EAAE,eAAe,GAAG,oBAAoB,CAAC;IAC/C,gGAAgG;IAChG,mBAAmB,CAAC,EAAE,MAAM,CAAC;IAC7B,8FAA8F;IAC9F,KAAK,CAAC,EAAE,MAAM,CAAC;CAChB;AAED;;;;GAIG;AACH,wBAAgB,wBAAwB,CAAC,OAAO,GAAE,sBAA2B,GAAG,MAAM,CAQrF"}
|
|
@@ -41,8 +41,8 @@ export function protectedResourceMetadataUrl(origin, path) {
|
|
|
41
41
|
}
|
|
42
42
|
/**
|
|
43
43
|
* The Poppy issuer `@adonis-agora/authkit-server` announces in `Symbol.for('@adonis-agora/poppy:issuer')`
|
|
44
|
-
* when Personal Agent Protocol is on — Poppy §
|
|
45
|
-
* to include it, so a Poppy
|
|
44
|
+
* when Personal Agent Protocol is on — Poppy §7 requires a listed MCP server's `authorization_servers`
|
|
45
|
+
* to include it, so a Poppy access token's issuer is one this server names.
|
|
46
46
|
*/
|
|
47
47
|
export function announcedPoppyIssuer() {
|
|
48
48
|
const value = globalThis[Symbol.for('@adonis-agora/poppy:issuer')];
|
package/dist/src/poppy/auth.d.ts
CHANGED
|
@@ -2,32 +2,35 @@ import type { Actor } from '../types.js';
|
|
|
2
2
|
/**
|
|
3
3
|
* Who a Poppy request comes from: a Personal Agent (`clientId`) acting for one of its Users
|
|
4
4
|
* (`userId`, the pairwise User ID — not an account) in one Session. `signedIn`, with the app
|
|
5
|
-
* account (`accountId`) and `scopes`,
|
|
6
|
-
* neither. The shape `@adonis-agora/authkit-server` answers.
|
|
5
|
+
* account (`accountId`) and `scopes`, on a request that carries an access token (§5.4); a signed-out
|
|
6
|
+
* request has neither. The shape `@adonis-agora/authkit-server` answers.
|
|
7
7
|
*/
|
|
8
8
|
export interface PoppyPrincipal {
|
|
9
9
|
/** The opaque, stable id the Personal Agent gave this User here. */
|
|
10
10
|
userId: string;
|
|
11
|
-
/**
|
|
11
|
+
/** Which of the User's agents this Session is for (§5.1), if the Personal Agent says. */
|
|
12
|
+
agentId?: string | null;
|
|
13
|
+
/** The app account, when the request carries an access token; `null` signed out. */
|
|
12
14
|
accountId: string | null;
|
|
13
15
|
/** The Personal Agent's `client_id` (its metadata document URL). */
|
|
14
16
|
clientId: string;
|
|
15
|
-
/** The token's
|
|
17
|
+
/** The access token's scopes. Empty signed out. */
|
|
16
18
|
scopes: string[];
|
|
17
19
|
sessionId: string;
|
|
18
20
|
signedIn: boolean;
|
|
19
21
|
/** The `resource` the token was issued for (RFC 8707), or `null`. */
|
|
20
22
|
resource?: string | null;
|
|
21
|
-
|
|
23
|
+
/** The access token's scheme; `null` signed out. */
|
|
24
|
+
tokenType?: 'DPoP' | 'Bearer' | null;
|
|
22
25
|
/** What the app's `personalAgents.poppy.toActor` answered, when it has one. */
|
|
23
26
|
actor?: Actor;
|
|
24
27
|
}
|
|
25
|
-
/** The request a resolver verifies — the Session
|
|
28
|
+
/** The request a resolver verifies — the `Poppy-Session` JWT and any access token are in `headers`. */
|
|
26
29
|
export interface PoppyAuthRequest {
|
|
27
30
|
method: string;
|
|
28
|
-
/** The full PUBLIC request URL (the
|
|
31
|
+
/** The full PUBLIC request URL (the Session JWT's `htu` is checked against it; the query is ignored). */
|
|
29
32
|
url: string;
|
|
30
|
-
/** The request's headers as received (lower-cased names) — `authorization` and `dpop` included. */
|
|
33
|
+
/** The request's headers as received (lower-cased names) — `poppy-session`, `authorization` and `dpop` included. */
|
|
31
34
|
headers: Record<string, string | string[] | undefined>;
|
|
32
35
|
}
|
|
33
36
|
/**
|
|
@@ -42,14 +45,15 @@ export interface PoppyAuthOptions {
|
|
|
42
45
|
}
|
|
43
46
|
export type PoppyAuthFailure = {
|
|
44
47
|
ok: false;
|
|
45
|
-
status: 400 | 401 | 403;
|
|
46
|
-
|
|
48
|
+
status: 400 | 401 | 403 | 429;
|
|
49
|
+
/** `null`: a challenge without a code (§8, the request needs the account) or a rate limit (§5.6). */
|
|
50
|
+
error: 'invalid_session' | 'invalid_token' | 'insufficient_scope' | 'invalid_dpop_proof' | 'use_dpop_nonce' | (string & {}) | null;
|
|
47
51
|
scope?: string;
|
|
48
|
-
/** The challenge to answer with, verbatim. */
|
|
49
|
-
wwwAuthenticate: string;
|
|
50
|
-
/** For logs and
|
|
52
|
+
/** The challenge to answer with, verbatim; `null` for `invalid_session` and rate limits. */
|
|
53
|
+
wwwAuthenticate: string | null;
|
|
54
|
+
/** For logs and `invalid_session`'s `error_description` — never a token. */
|
|
51
55
|
description?: string;
|
|
52
|
-
/** Extra headers to answer with (`DPoP-Nonce`). */
|
|
56
|
+
/** Extra headers to answer with (`DPoP-Nonce`, `Retry-After`). */
|
|
53
57
|
headers?: Record<string, string>;
|
|
54
58
|
};
|
|
55
59
|
export type PoppyAuthResult = {
|
|
@@ -57,10 +61,10 @@ export type PoppyAuthResult = {
|
|
|
57
61
|
principal: PoppyPrincipal;
|
|
58
62
|
} | PoppyAuthFailure;
|
|
59
63
|
/**
|
|
60
|
-
* Verifies a request's Session
|
|
64
|
+
* Verifies a request's Session header and any access token. `@adonis-agora/authkit-server` installs one in the global
|
|
61
65
|
* slot {@link POPPY_AUTHENTICATE_SLOT}; an app can pass its own (`definePoppyConfig({ authenticate })`).
|
|
62
66
|
*
|
|
63
|
-
* @experimental Tracks Personal Agent Protocol Draft 0.
|
|
67
|
+
* @experimental Tracks Personal Agent Protocol Draft 0.3 (https://personalagentprotocol.org/docs/spec),
|
|
64
68
|
* a spec still in development: this API WILL change as the spec evolves — possibly in breaking
|
|
65
69
|
* ways, outside semver majors while it is a draft.
|
|
66
70
|
*/
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"auth.d.ts","sourceRoot":"","sources":["../../../src/poppy/auth.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,KAAK,EAAE,MAAM,aAAa,CAAC;AAEzC;;;;;GAKG;AACH,MAAM,WAAW,cAAc;IAC7B,oEAAoE;IACpE,MAAM,EAAE,MAAM,CAAC;IACf,
|
|
1
|
+
{"version":3,"file":"auth.d.ts","sourceRoot":"","sources":["../../../src/poppy/auth.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,KAAK,EAAE,MAAM,aAAa,CAAC;AAEzC;;;;;GAKG;AACH,MAAM,WAAW,cAAc;IAC7B,oEAAoE;IACpE,MAAM,EAAE,MAAM,CAAC;IACf,yFAAyF;IACzF,OAAO,CAAC,EAAE,MAAM,GAAG,IAAI,CAAC;IACxB,oFAAoF;IACpF,SAAS,EAAE,MAAM,GAAG,IAAI,CAAC;IACzB,oEAAoE;IACpE,QAAQ,EAAE,MAAM,CAAC;IACjB,mDAAmD;IACnD,MAAM,EAAE,MAAM,EAAE,CAAC;IACjB,SAAS,EAAE,MAAM,CAAC;IAClB,QAAQ,EAAE,OAAO,CAAC;IAClB,qEAAqE;IACrE,QAAQ,CAAC,EAAE,MAAM,GAAG,IAAI,CAAC;IACzB,oDAAoD;IACpD,SAAS,CAAC,EAAE,MAAM,GAAG,QAAQ,GAAG,IAAI,CAAC;IACrC,+EAA+E;IAC/E,KAAK,CAAC,EAAE,KAAK,CAAC;CACf;AAED,uGAAuG;AACvG,MAAM,WAAW,gBAAgB;IAC/B,MAAM,EAAE,MAAM,CAAC;IACf,yGAAyG;IACzG,GAAG,EAAE,MAAM,CAAC;IACZ,oHAAoH;IACpH,OAAO,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,GAAG,MAAM,EAAE,GAAG,SAAS,CAAC,CAAC;CACxD;AAED;;;;GAIG;AACH,MAAM,WAAW,gBAAgB;IAC/B,MAAM,CA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oot":"","sources":["../../../src/poppy/auth.ts"],"names":[],"mappings":"AAqFA;;;GAGG;AACH,MAAM,CAAC,MAAM,uBAAuB,GAAG,MAAM,CAAC,GAAG,CAAC,kCAAkC,CAAC,CAAC;AAEtF,sGAAsG;AACtG,MAAM,UAAU,uBAAuB;IACrC,MAAM,KAAK,GAAI,UAAsC,CAAC,uBAAuB,CAAC,CAAC;IAC/E,OAAO,OAAO,KAAK,KAAK,UAAU,CAAC,CAAC,CAAE,KAA2B,CAAC,CAAC,CAAC,SAAS,CAAC;AAChF,CAAC;AAED,+FAA+F;AAC/F,MAAM,UAAU,iBAAiB;IAC/B,MAAM,KAAK,GAAI,UAAsC,CAAC,MAAM,CAAC,GAAG,CAAC,4BAA4B,CAAC,CAAC,CAAC;IAChG,OAAO,OAAO,KAAK,KAAK,QAAQ,IAAI,KAAK,KAAK,EAAE,CAAC,CAAC,CAAC,KAAK,CAAC,CAAC,CAAC,SAAS,CAAC;AACvE,CAAC"}
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { type A2aActionPolicy, type A2aTurnOutcome, type A2aTurnService } from '../a2a/turn.js';
|
|
2
2
|
import type { Actor } from '../types.js';
|
|
3
3
|
import type { PoppyPrincipal } from './auth.js';
|
|
4
|
-
import { type PoppyEvent, type PoppyEventMessage, type PoppyResponder, type PoppySendBody, type
|
|
4
|
+
import { type PoppyAuthor, type PoppyEvent, type PoppyEventMessage, type PoppyResponder, type PoppySendBody, type PoppyStatus } from './protocol.js';
|
|
5
5
|
import { type PoppyConversationRecord, type PoppyStore } from './store.js';
|
|
6
6
|
/** What the hooks are told about a conversation. */
|
|
7
7
|
export interface PoppyHookContext {
|
|
@@ -15,13 +15,13 @@ export interface PoppyHookContext {
|
|
|
15
15
|
* - `'queued'` — someone will join: call {@link PoppyConversations.humanJoined} when they do, or
|
|
16
16
|
* {@link PoppyConversations.handoffUnavailable} if nobody can.
|
|
17
17
|
* - `'joined'` — a person took it now.
|
|
18
|
-
* - `{ unavailable }` — nobody can; the text is what the Company Agent says (§
|
|
18
|
+
* - `{ unavailable }` — nobody can; the text is what the Company Agent says (§8.9).
|
|
19
19
|
*/
|
|
20
20
|
export type PoppyHandoffDecision = 'queued' | 'joined' | {
|
|
21
21
|
unavailable: string;
|
|
22
22
|
};
|
|
23
23
|
/**
|
|
24
|
-
* How the app brings a person in (§
|
|
24
|
+
* How the app brings a person in (§8.9). Without these, a handoff is answered by the Company Agent
|
|
25
25
|
* saying no one is available — the conversation stays with the agent.
|
|
26
26
|
*/
|
|
27
27
|
export interface PoppyHandoffHooks {
|
|
@@ -36,10 +36,10 @@ export interface PoppyHandoffHooks {
|
|
|
36
36
|
message?(ctx: PoppyHookContext & {
|
|
37
37
|
message: PoppyEventMessage;
|
|
38
38
|
}): void | Promise<void>;
|
|
39
|
-
/** The conversation closed while a person was handling it or being found (§
|
|
39
|
+
/** The conversation closed while a person was handling it or being found (§8.12). */
|
|
40
40
|
cancel?(ctx: PoppyHookContext): void | Promise<void>;
|
|
41
41
|
}
|
|
42
|
-
/** Notified when the Personal Agent opens or closes a Direct Conversation (§
|
|
42
|
+
/** Notified when the Personal Agent opens or closes a Direct Conversation (§8.10). */
|
|
43
43
|
export interface PoppyDirectHooks {
|
|
44
44
|
opened?(ctx: PoppyHookContext & {
|
|
45
45
|
parentId: string;
|
|
@@ -50,11 +50,11 @@ export interface PoppyDirectHooks {
|
|
|
50
50
|
}
|
|
51
51
|
/** What the Company Agent says on its own. */
|
|
52
52
|
export interface PoppyTexts {
|
|
53
|
-
/** A handoff with no one to take it (§
|
|
53
|
+
/** A handoff with no one to take it (§8.9). */
|
|
54
54
|
handoffUnavailable: string;
|
|
55
55
|
/** A turn that failed before saying anything. */
|
|
56
56
|
failed: string;
|
|
57
|
-
/** Asked in a Direct Conversation alongside an `authorization` event (§
|
|
57
|
+
/** Asked in a Direct Conversation alongside an `authorization` event (§8.11 SHOULD). */
|
|
58
58
|
signIn: string;
|
|
59
59
|
/** An action that ran — `{title}` is the app's confirmation title (default {@link formatPoppyAction}). */
|
|
60
60
|
actionSucceeded: string;
|
|
@@ -67,7 +67,7 @@ export declare const DEFAULT_POPPY_TEXTS: PoppyTexts;
|
|
|
67
67
|
/** An action of the turn, as the reply's `data.actions` carries it. */
|
|
68
68
|
export type PoppyActionOutcome = A2aTurnOutcome;
|
|
69
69
|
/**
|
|
70
|
-
* Words an action for the reply's text (§
|
|
70
|
+
* Words an action for the reply's text (§8: the message must make sense without `data`). Return
|
|
71
71
|
* `null` to leave it out. Default {@link formatPoppyAction}.
|
|
72
72
|
*/
|
|
73
73
|
export type PoppyActionFormatter = (action: PoppyActionOutcome, texts: PoppyTexts) => string | null | undefined;
|
|
@@ -106,7 +106,7 @@ export interface PoppyConversationsOptions {
|
|
|
106
106
|
/** Logs what fails outside a request (a turn, a hook). */
|
|
107
107
|
onError?: (error: unknown, context: string) => void;
|
|
108
108
|
}
|
|
109
|
-
/** What a read answers (§
|
|
109
|
+
/** What a read answers (§8.5). */
|
|
110
110
|
export interface PoppyReadResult {
|
|
111
111
|
conversation_id: string;
|
|
112
112
|
events: PoppyEvent[];
|
|
@@ -115,7 +115,7 @@ export interface PoppyReadResult {
|
|
|
115
115
|
status: PoppyStatus;
|
|
116
116
|
responder: PoppyResponder;
|
|
117
117
|
}
|
|
118
|
-
/** What a stream yields: a stored event, or a provisional piece of text (§
|
|
118
|
+
/** What a stream yields: a stored event, or a provisional piece of text (§8.6). */
|
|
119
119
|
export type PoppyStreamItem = {
|
|
120
120
|
kind: 'event';
|
|
121
121
|
event: PoppyEvent;
|
|
@@ -130,7 +130,7 @@ export type PoppyStreamItem = {
|
|
|
130
130
|
/** The actor of a principal the resolver gave none: stable per (Personal Agent, its User). */
|
|
131
131
|
export declare function poppyActorId(clientId: string, userId: string): string;
|
|
132
132
|
/**
|
|
133
|
-
* Poppy conversations (§
|
|
133
|
+
* Poppy conversations (§8) over the agent runtime: the state machine, the event log and the turns.
|
|
134
134
|
* HTTP-free — `createPoppyHandler` puts the protocol's requests on it, and the app drives the
|
|
135
135
|
* Company side through it (a person joining, their messages, `user_requested`).
|
|
136
136
|
*
|
|
@@ -140,7 +140,7 @@ export declare function poppyActorId(clientId: string, userId: string): string;
|
|
|
140
140
|
* then appends the reply as a `message` event. A replica that finds a conversation `working` with
|
|
141
141
|
* no pump picks it up, so a reply survives the process that started it.
|
|
142
142
|
*
|
|
143
|
-
* @experimental Tracks Personal Agent Protocol Draft 0.
|
|
143
|
+
* @experimental Tracks Personal Agent Protocol Draft 0.3 (https://personalagentprotocol.org/docs/spec),
|
|
144
144
|
* a spec still in development: this API WILL change as the spec evolves — possibly in breaking
|
|
145
145
|
* ways, outside semver majors while it is a draft.
|
|
146
146
|
*/
|
|
@@ -163,17 +163,17 @@ export declare class PoppyConversations {
|
|
|
163
163
|
body: Record<string, unknown>;
|
|
164
164
|
conversationId: string;
|
|
165
165
|
}>;
|
|
166
|
-
/** `POST {endpoint}/{id}/messages` — another message (§
|
|
166
|
+
/** `POST {endpoint}/{id}/messages` — another message (§8.3). */
|
|
167
167
|
send(principal: PoppyPrincipal, conversationId: string, body: PoppySendBody): Promise<{
|
|
168
168
|
status: number;
|
|
169
169
|
body: Record<string, unknown>;
|
|
170
170
|
}>;
|
|
171
|
-
/** `GET {endpoint}/{id}/events` without streaming — read (and wait for) events (§
|
|
171
|
+
/** `GET {endpoint}/{id}/events` without streaming — read (and wait for) events (§8.5). */
|
|
172
172
|
read(principal: PoppyPrincipal, conversationId: string, options: {
|
|
173
173
|
cursor?: string;
|
|
174
174
|
waitMs?: number;
|
|
175
175
|
}): Promise<PoppyReadResult>;
|
|
176
|
-
/** A read of a conversation already checked — also what a POST with `wait` answers (§
|
|
176
|
+
/** A read of a conversation already checked — also what a POST with `wait` answers (§8.3). */
|
|
177
177
|
readOwned(conversation: PoppyConversationRecord, options: {
|
|
178
178
|
cursor?: string;
|
|
179
179
|
waitMs?: number;
|
|
@@ -181,17 +181,17 @@ export declare class PoppyConversations {
|
|
|
181
181
|
/** Check a conversation is the principal's, for a caller that reads it afterwards. */
|
|
182
182
|
owned(principal: PoppyPrincipal, conversationId: string): Promise<PoppyConversationRecord>;
|
|
183
183
|
/**
|
|
184
|
-
* `GET {endpoint}/{id}/events` as SSE (§
|
|
184
|
+
* `GET {endpoint}/{id}/events` as SSE (§8.6): the events after `cursor`, then new ones as they
|
|
185
185
|
* come, with `text-delta` pieces of a reply being written in this process. Ends when `signal`
|
|
186
186
|
* aborts, or once the conversation is closed and every event was sent.
|
|
187
187
|
*/
|
|
188
188
|
stream(conversation: PoppyConversationRecord, cursor: string | undefined, signal: AbortSignal): AsyncGenerator<PoppyStreamItem>;
|
|
189
|
-
/** `POST {endpoint}/{id}/handoff` — ask for a person at the Company (§
|
|
189
|
+
/** `POST {endpoint}/{id}/handoff` — ask for a person at the Company (§8.9). */
|
|
190
190
|
requestHandoff(principal: PoppyPrincipal, conversationId: string): Promise<{
|
|
191
191
|
status: PoppyStatus;
|
|
192
192
|
responder: PoppyResponder;
|
|
193
193
|
}>;
|
|
194
|
-
/** `POST {endpoint}/{id}/close` — close the conversation (§
|
|
194
|
+
/** `POST {endpoint}/{id}/close` — close the conversation (§8.12). */
|
|
195
195
|
closeByAgent(principal: PoppyPrincipal, conversationId: string): Promise<{
|
|
196
196
|
status: PoppyStatus;
|
|
197
197
|
responder: PoppyResponder;
|
|
@@ -199,19 +199,19 @@ export declare class PoppyConversations {
|
|
|
199
199
|
/** Look a conversation up — for the app's own routing (a support tool, an admin page). */
|
|
200
200
|
get(conversationId: string): Promise<PoppyConversationRecord | null>;
|
|
201
201
|
/**
|
|
202
|
-
* Close a conversation (§
|
|
202
|
+
* Close a conversation (§8.12): its open Direct Conversation first, a pending handoff is
|
|
203
203
|
* cancelled, and a `closed` state event added. Nothing it started is undone. Idempotent.
|
|
204
204
|
*/
|
|
205
205
|
close(conversationId: string): Promise<{
|
|
206
206
|
status: PoppyStatus;
|
|
207
207
|
responder: PoppyResponder;
|
|
208
208
|
}>;
|
|
209
|
-
/** The Company Agent hands off to a person on its own (§
|
|
209
|
+
/** The Company Agent hands off to a person on its own (§8.9) — e.g. from one of your tools. */
|
|
210
210
|
handoff(conversationId: string): Promise<{
|
|
211
211
|
status: PoppyStatus;
|
|
212
212
|
responder: PoppyResponder;
|
|
213
213
|
}>;
|
|
214
|
-
/** A person at the Company joined: `responder` becomes `human` (§
|
|
214
|
+
/** A person at the Company joined: `responder` becomes `human` (§8.7). */
|
|
215
215
|
humanJoined(conversationId: string): Promise<{
|
|
216
216
|
status: PoppyStatus;
|
|
217
217
|
responder: PoppyResponder;
|
|
@@ -223,23 +223,23 @@ export declare class PoppyConversations {
|
|
|
223
223
|
}>;
|
|
224
224
|
/**
|
|
225
225
|
* No one could take a queued handoff: the Company Agent says why, and the conversation goes back
|
|
226
|
-
* to `idle` with the agent (§
|
|
226
|
+
* to `idle` with the agent (§8.9).
|
|
227
227
|
*/
|
|
228
228
|
handoffUnavailable(conversationId: string, reason?: string): Promise<{
|
|
229
229
|
status: PoppyStatus;
|
|
230
230
|
responder: PoppyResponder;
|
|
231
231
|
}>;
|
|
232
232
|
/**
|
|
233
|
-
* Add a Company message — a person's (`
|
|
233
|
+
* Add a Company message — a person's (`author.type: 'human'`, while they handle the conversation) or
|
|
234
234
|
* an automated one. Answers the message's id.
|
|
235
235
|
*/
|
|
236
236
|
postMessage(conversationId: string, message: {
|
|
237
237
|
text?: string;
|
|
238
238
|
data?: Record<string, unknown>;
|
|
239
|
-
|
|
239
|
+
author: PoppyAuthor;
|
|
240
240
|
}): Promise<string>;
|
|
241
241
|
/**
|
|
242
|
-
* Ask to talk with the User directly (§
|
|
242
|
+
* Ask to talk with the User directly (§8.10): a `user_requested` event. Only the Personal Agent
|
|
243
243
|
* opens the Direct Conversation, once the User agrees.
|
|
244
244
|
*/
|
|
245
245
|
requestUser(conversationId: string, reason: string): Promise<void>;
|