@cuylabs/channel-teams-agent-core 0.4.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.
@@ -0,0 +1,40 @@
1
+ import { TurnContext } from '@microsoft/agents-hosting';
2
+ import { Conversation } from '@cuylabs/channel-m365-agent-core/proactive';
3
+ export { Conversation, ConversationBuilder, ConversationClaims, ConversationReference, ConversationReferenceBuilder, CreateConversationOptions, CreateConversationOptionsBuilder, M365ConversationInput, M365ConversationRecord, ProactiveIdentity, captureM365ConversationReference, continueM365Conversation, restoreM365ConversationReference } from '@cuylabs/channel-m365-agent-core/proactive';
4
+ import { TeamsActivityInfo } from '@cuylabs/channel-teams';
5
+
6
+ /**
7
+ * Proactive messaging primitives for the Teams channel.
8
+ *
9
+ * Re-exports the M365 proactive bridge so Teams consumers have a single
10
+ * import surface, plus a Teams-specific helper that captures a
11
+ * {@link Conversation} together with the parsed Teams metadata most apps
12
+ * need at replay time (tenant, surface, team, channel thread, meeting id).
13
+ *
14
+ * Use this module when an app needs to send a message into Teams without an
15
+ * inbound turn — async tool completions, mail dispatcher results,
16
+ * notifications, scheduled reminders.
17
+ */
18
+
19
+ /**
20
+ * Captured Teams conversation reference plus parsed channel metadata.
21
+ *
22
+ * The {@link Conversation} is what `continueM365Conversation` needs to replay
23
+ * a turn; `teams` is the parsed {@link TeamsActivityInfo} so callers can
24
+ * persist surface / tenant / team / channel ids alongside the reference for
25
+ * later routing decisions.
26
+ */
27
+ interface TeamsProactiveCapture {
28
+ conversation: Conversation;
29
+ teams: TeamsActivityInfo;
30
+ }
31
+ /**
32
+ * Capture a serializable {@link Conversation} from a live Teams turn alongside
33
+ * the parsed Teams metadata. Validates the captured reference.
34
+ *
35
+ * Persist the result to your storage of choice; replay later through
36
+ * `continueM365Conversation(adapter, capture.conversation, async (ctx) => …)`.
37
+ */
38
+ declare function captureTeamsConversationReference(context: TurnContext): TeamsProactiveCapture;
39
+
40
+ export { type TeamsProactiveCapture, captureTeamsConversationReference };
@@ -0,0 +1,20 @@
1
+ import {
2
+ Conversation,
3
+ ConversationBuilder,
4
+ ConversationReferenceBuilder,
5
+ CreateConversationOptionsBuilder,
6
+ captureM365ConversationReference,
7
+ captureTeamsConversationReference,
8
+ continueM365Conversation,
9
+ restoreM365ConversationReference
10
+ } from "./chunk-ZULHZARA.js";
11
+ export {
12
+ Conversation,
13
+ ConversationBuilder,
14
+ ConversationReferenceBuilder,
15
+ CreateConversationOptionsBuilder,
16
+ captureM365ConversationReference,
17
+ captureTeamsConversationReference,
18
+ continueM365Conversation,
19
+ restoreM365ConversationReference
20
+ };
package/docs/README.md ADDED
@@ -0,0 +1,16 @@
1
+ # @cuylabs/channel-teams-agent-core Docs
2
+
3
+ This package contains the Teams adapter for `@cuylabs/agent-core`.
4
+
5
+ ## Concepts
6
+
7
+ - `createTeamsChannelAdapter` wraps the generic M365 adapter with Teams routing.
8
+ - `mountTeamsAgent` mounts the adapter behind an Express route.
9
+ - Teams handlers can answer invoke activities directly with `ctx.sendInvoke`.
10
+ - Teams handlers can call `ctx.runAgent(...)` to start an agent turn inside the
11
+ active Teams request context.
12
+ - `currentTeamsTurnContext()` exposes parsed Teams metadata to tools and
13
+ middleware during a turn.
14
+
15
+ For Teams primitives without an agent runtime dependency, use
16
+ `@cuylabs/channel-teams`.
package/package.json ADDED
@@ -0,0 +1,93 @@
1
+ {
2
+ "name": "@cuylabs/channel-teams-agent-core",
3
+ "version": "0.4.0",
4
+ "description": "Teams adapter for @cuylabs/agent-core built on @cuylabs/channel-teams",
5
+ "type": "module",
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
+ "default": "./dist/index.js"
13
+ },
14
+ "./extensions": {
15
+ "types": "./dist/extensions.d.ts",
16
+ "import": "./dist/extensions.js",
17
+ "default": "./dist/extensions.js"
18
+ },
19
+ "./proactive": {
20
+ "types": "./dist/proactive.d.ts",
21
+ "import": "./dist/proactive.js",
22
+ "default": "./dist/proactive.js"
23
+ }
24
+ },
25
+ "files": [
26
+ "dist",
27
+ "docs",
28
+ "README.md"
29
+ ],
30
+ "dependencies": {
31
+ "@cuylabs/agent-core": "^7.2.0",
32
+ "@cuylabs/channel-m365-agent-core": "^0.4.0",
33
+ "@cuylabs/channel-teams": "^0.4.0"
34
+ },
35
+ "peerDependencies": {
36
+ "@microsoft/agents-activity": "^1.5.0",
37
+ "@microsoft/agents-hosting": "^1.5.0",
38
+ "@microsoft/agents-hosting-extensions-teams": "^1.5.0",
39
+ "@microsoft/agents-telemetry": "^1.5.0",
40
+ "express": ">=4.21.0 || >=5.0.0"
41
+ },
42
+ "peerDependenciesMeta": {
43
+ "@microsoft/agents-telemetry": {
44
+ "optional": true
45
+ },
46
+ "express": {
47
+ "optional": true
48
+ }
49
+ },
50
+ "devDependencies": {
51
+ "@microsoft/agents-activity": "^1.5.3",
52
+ "@microsoft/agents-hosting": "^1.5.3",
53
+ "@microsoft/agents-hosting-extensions-teams": "^1.5.3",
54
+ "@microsoft/agents-telemetry": "^1.5.3",
55
+ "@types/express": "^5.0.0",
56
+ "@types/node": "^22.0.0",
57
+ "express": "^5.2.1",
58
+ "tsup": "^8.0.0",
59
+ "typescript": "^5.7.0",
60
+ "vitest": "^4.0.18"
61
+ },
62
+ "keywords": [
63
+ "agent",
64
+ "teams",
65
+ "microsoft",
66
+ "m365",
67
+ "channel",
68
+ "adapter",
69
+ "agent-core"
70
+ ],
71
+ "author": "cuylabs",
72
+ "license": "Apache-2.0",
73
+ "repository": {
74
+ "type": "git",
75
+ "url": "https://github.com/cuylabs-ai/agent-channels-ts.git",
76
+ "directory": "packages/channel-teams-agent-core"
77
+ },
78
+ "publishConfig": {
79
+ "access": "public"
80
+ },
81
+ "engines": {
82
+ "node": ">=20"
83
+ },
84
+ "scripts": {
85
+ "build": "tsup src/index.ts src/extensions.ts src/proactive.ts --format esm --dts --clean",
86
+ "clean": "rm -rf dist",
87
+ "dev": "tsup src/index.ts src/extensions.ts src/proactive.ts --format esm --dts --watch",
88
+ "lint": "eslint \"src/**/*.{ts,tsx}\" \"tests/**/*.{ts,tsx}\" --max-warnings=0",
89
+ "test": "vitest run",
90
+ "test:watch": "vitest",
91
+ "typecheck": "tsc --noEmit"
92
+ }
93
+ }