@levelcode/sdk 0.1.0 → 0.2.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.
Files changed (70) hide show
  1. package/README.md +104 -0
  2. package/dist/agents/constants.d.ts +1 -0
  3. package/dist/agents/team/apprentice.d.ts +3 -0
  4. package/dist/agents/team/coordinator.d.ts +3 -0
  5. package/dist/agents/team/cto.d.ts +3 -0
  6. package/dist/agents/team/designer.d.ts +3 -0
  7. package/dist/agents/team/director.d.ts +3 -0
  8. package/dist/agents/team/distinguished-engineer.d.ts +3 -0
  9. package/dist/agents/team/fellow.d.ts +3 -0
  10. package/dist/agents/team/index.d.ts +27 -0
  11. package/dist/agents/team/intern.d.ts +3 -0
  12. package/dist/agents/team/junior-engineer.d.ts +3 -0
  13. package/dist/agents/team/manager.d.ts +3 -0
  14. package/dist/agents/team/mid-level-engineer.d.ts +3 -0
  15. package/dist/agents/team/principal-engineer.d.ts +3 -0
  16. package/dist/agents/team/product-lead.d.ts +3 -0
  17. package/dist/agents/team/researcher.d.ts +3 -0
  18. package/dist/agents/team/role-hierarchy.d.ts +24 -0
  19. package/dist/agents/team/scientist.d.ts +3 -0
  20. package/dist/agents/team/senior-engineer.d.ts +3 -0
  21. package/dist/agents/team/senior-staff-engineer.d.ts +3 -0
  22. package/dist/agents/team/staff-engineer.d.ts +3 -0
  23. package/dist/agents/team/sub-manager.d.ts +3 -0
  24. package/dist/agents/team/tester.d.ts +3 -0
  25. package/dist/agents/team/vp-engineering.d.ts +3 -0
  26. package/dist/agents/types/agent-definition.d.ts +296 -0
  27. package/dist/agents/types/secret-agent-definition.d.ts +19 -0
  28. package/dist/agents/types/tools.d.ts +308 -0
  29. package/dist/agents/types/util-types.d.ts +134 -0
  30. package/dist/common/src/constants/analytics-events.d.ts +5 -1
  31. package/dist/common/src/constants/model-config.d.ts +1 -1
  32. package/dist/common/src/tools/list.d.ts +18 -6
  33. package/dist/common/src/tools/params/tool/run-file-change-hooks.d.ts +2 -2
  34. package/dist/common/src/tools/params/tool/run-terminal-command.d.ts +3 -3
  35. package/dist/common/src/tools/params/tool/send-message.d.ts +2 -2
  36. package/dist/common/src/tools/params/tool/task-create.d.ts +6 -0
  37. package/dist/common/src/tools/params/tool/task-update.d.ts +6 -0
  38. package/dist/common/src/types/print-mode.d.ts +2 -2
  39. package/dist/common/src/types/team-config-schemas.d.ts +213 -0
  40. package/dist/common/src/types/team-config.d.ts +4 -1
  41. package/dist/common/src/types/team-hook-events.d.ts +36 -0
  42. package/dist/common/src/utils/dev-phases.d.ts +23 -0
  43. package/dist/common/src/utils/file-lock.d.ts +13 -0
  44. package/dist/common/src/utils/team-analytics.d.ts +16 -0
  45. package/dist/common/src/utils/team-discovery.d.ts +47 -0
  46. package/dist/common/src/utils/team-fs.d.ts +9 -6
  47. package/dist/common/src/utils/team-hook-emitter.d.ts +40 -0
  48. package/dist/common/src/utils/team-presets.d.ts +35 -0
  49. package/dist/index.cjs +5339 -1554
  50. package/dist/index.cjs.map +62 -24
  51. package/dist/index.mjs +6027 -2242
  52. package/dist/index.mjs.map +62 -24
  53. package/dist/packages/agent-runtime/src/inbox-poller.d.ts +81 -0
  54. package/dist/packages/agent-runtime/src/message-formatter.d.ts +12 -0
  55. package/dist/packages/agent-runtime/src/system-prompt/team-context-prompt.d.ts +9 -0
  56. package/dist/packages/agent-runtime/src/system-prompt/team-prompt.d.ts +9 -0
  57. package/dist/packages/agent-runtime/src/team-context.d.ts +14 -0
  58. package/dist/packages/agent-runtime/src/templates/agent-registry.d.ts +1 -1
  59. package/dist/packages/agent-runtime/src/tools/handlers/list.d.ts +20 -1
  60. package/dist/packages/agent-runtime/src/tools/handlers/tool/send-message.d.ts +5 -0
  61. package/dist/packages/agent-runtime/src/tools/handlers/tool/spawn-agent-utils.d.ts +31 -1
  62. package/dist/packages/agent-runtime/src/tools/handlers/tool/spawn-agents.d.ts +2 -0
  63. package/dist/packages/agent-runtime/src/tools/handlers/tool/task-completed.d.ts +9 -1
  64. package/dist/packages/agent-runtime/src/tools/handlers/tool/task-update.d.ts +5 -0
  65. package/dist/packages/agent-runtime/src/tools/handlers/tool/team-create.d.ts +5 -0
  66. package/dist/packages/agent-runtime/src/tools/handlers/tool/team-delete.d.ts +5 -0
  67. package/dist/sdk/src/__tests__/team-api.test.d.ts +1 -0
  68. package/dist/sdk/src/client.d.ts +38 -0
  69. package/dist/sdk/src/team.d.ts +49 -0
  70. package/package.json +1 -1
@@ -0,0 +1,81 @@
1
+ import type { TeamProtocolMessage } from '@levelcode/common/types/team-protocol';
2
+ import type { Logger } from '@levelcode/common/types/contracts/logger';
3
+ export interface InboxPollerConfig {
4
+ teamName: string;
5
+ agentName: string;
6
+ pollIntervalMs?: number;
7
+ logger: Logger;
8
+ }
9
+ export interface InboxPollResult {
10
+ messages: TeamProtocolMessage[];
11
+ formattedContent: string | null;
12
+ }
13
+ /**
14
+ * InboxPoller continuously polls an agent's inbox file for new messages
15
+ * and provides them in a format suitable for injection into the agent's
16
+ * next prompt turn.
17
+ *
18
+ * Usage:
19
+ * const poller = new InboxPoller({ teamName, agentName, logger })
20
+ * poller.start()
21
+ * // Between agent turns:
22
+ * const result = poller.drain()
23
+ * if (result.formattedContent) {
24
+ * // inject into message history
25
+ * }
26
+ * // When agent shuts down:
27
+ * poller.stop()
28
+ */
29
+ export declare class InboxPoller {
30
+ private teamName;
31
+ private agentName;
32
+ private pollIntervalMs;
33
+ private logger;
34
+ private timer;
35
+ private pendingMessages;
36
+ private running;
37
+ constructor(config: InboxPollerConfig);
38
+ /**
39
+ * Start polling the inbox file at the configured interval.
40
+ */
41
+ start(): void;
42
+ /**
43
+ * Stop polling.
44
+ */
45
+ stop(): void;
46
+ /**
47
+ * Poll the inbox once and accumulate any new messages.
48
+ * Messages are read from the filesystem and the inbox is cleared
49
+ * after reading to prevent duplicate delivery.
50
+ */
51
+ private poll;
52
+ /**
53
+ * Drain all accumulated pending messages and return them.
54
+ * After calling drain(), the internal buffer is cleared.
55
+ * Returns both the raw messages and a formatted string suitable
56
+ * for injection into the agent's message history.
57
+ */
58
+ drain(): InboxPollResult;
59
+ /**
60
+ * Check if there are any pending messages without draining them.
61
+ */
62
+ hasPendingMessages(): boolean;
63
+ /**
64
+ * Force an immediate poll (useful before draining between turns).
65
+ */
66
+ pollNow(): void;
67
+ /**
68
+ * Returns whether the poller is currently running.
69
+ */
70
+ isRunning(): boolean;
71
+ }
72
+ /**
73
+ * One-shot convenience function: reads the inbox, formats messages,
74
+ * clears the inbox, and returns the result. Useful when you don't need
75
+ * continuous background polling and just want to check between turns.
76
+ */
77
+ export declare function drainInbox(params: {
78
+ teamName: string;
79
+ agentName: string;
80
+ logger: Logger;
81
+ }): InboxPollResult;
@@ -0,0 +1,12 @@
1
+ import type { TeamProtocolMessage } from '@levelcode/common/types/team-protocol';
2
+ /**
3
+ * Formats a single TeamProtocolMessage into a human-readable string
4
+ * suitable for injection into an agent's message history.
5
+ */
6
+ export declare function formatTeamMessage(message: TeamProtocolMessage): string;
7
+ /**
8
+ * Formats an array of TeamProtocolMessages into a single string block
9
+ * wrapped in a system-level container tag, ready for injection into
10
+ * the agent's message history.
11
+ */
12
+ export declare function formatInboxMessages(messages: TeamProtocolMessage[]): string | null;
@@ -0,0 +1,9 @@
1
+ import type { DevPhase, TeamRole } from '@levelcode/common/types/team-config';
2
+ export interface TeamContextPromptConfig {
3
+ teamName: string;
4
+ agentName: string;
5
+ role: TeamRole;
6
+ phase: DevPhase;
7
+ isLeader: boolean;
8
+ }
9
+ export declare function generateTeamContextPrompt(config: TeamContextPromptConfig): string;
@@ -0,0 +1,9 @@
1
+ import type { DevPhase, TeamRole } from '@levelcode/common/types/team-config';
2
+ /**
3
+ * Generates a system prompt section explaining the agent's team context.
4
+ * This is the primary entry point for injecting team awareness into agent system prompts.
5
+ *
6
+ * Delegates to generateTeamContextPrompt for role-based guidance, communication
7
+ * protocols, task workflows, idle behavior, and shutdown instructions.
8
+ */
9
+ export declare function generateTeamPromptSection(teamName: string, agentName: string, role: TeamRole, phase: DevPhase): string;
@@ -0,0 +1,14 @@
1
+ import type { TeamConfig } from '@levelcode/common/types/team-config';
2
+ export interface TeamContext {
3
+ teamName: string;
4
+ agentName: string;
5
+ config: TeamConfig;
6
+ }
7
+ /**
8
+ * Discovers the team context for a given agent identifier.
9
+ * Scans all team directories to find which team the agent belongs to.
10
+ * Matches against both the raw agentId and a "lead-" prefixed variant.
11
+ *
12
+ * Returns null if the agent is not part of any team (e.g., standalone mode).
13
+ */
14
+ export declare function findTeamContext(agentIdentifier: string): TeamContext | null;
@@ -18,7 +18,7 @@ export declare function getAgentTemplate(params: {
18
18
  logger: Logger;
19
19
  } & ParamsExcluding<FetchAgentFromDatabaseFn, 'parsedAgentId'>): Promise<AgentTemplate | null>;
20
20
  /**
21
- * Assemble local agent templates from fileContext + static templates
21
+ * Assemble local agent templates from fileContext + static templates + team agents
22
22
  */
23
23
  export declare function assembleLocalAgentTemplates(params: {
24
24
  fileContext: ProjectFileContext;
@@ -194,6 +194,7 @@ export declare const levelcodeToolHandlers: {
194
194
  logger: import("@levelcode/common/types/contracts/logger").Logger;
195
195
  system: string;
196
196
  tools?: import("ai").ToolSet;
197
+ trackEvent: import("@levelcode/common/types/contracts/analytics").TrackEventFn;
197
198
  userId: string | undefined;
198
199
  userInputId: string;
199
200
  sendSubagentChunk: import("./tool/spawn-agents").SendSubagentChunk;
@@ -237,9 +238,15 @@ export declare const levelcodeToolHandlers: {
237
238
  }) => Promise<{
238
239
  output: import("src").LevelCodeToolOutput<"suggest_followups">;
239
240
  }>;
240
- task_completed: ({ previousToolCallFinished, }: {
241
+ task_completed: ({ previousToolCallFinished, trackEvent, userId, logger, agentTemplate, }: {
241
242
  previousToolCallFinished: Promise<any>;
242
243
  toolCall: import("@levelcode/common/tools/list").LevelCodeToolCall<"task_completed">;
244
+ trackEvent: import("@levelcode/common/types/contracts/analytics").TrackEventFn;
245
+ userId: string | undefined;
246
+ logger: import("@levelcode/common/types/contracts/logger").Logger;
247
+ agentTemplate: {
248
+ name: string;
249
+ };
243
250
  }) => Promise<{
244
251
  output: import("src").LevelCodeToolOutput<"task_completed">;
245
252
  }>;
@@ -264,6 +271,9 @@ export declare const levelcodeToolHandlers: {
264
271
  task_update: (params: {
265
272
  previousToolCallFinished: Promise<void>;
266
273
  toolCall: import("@levelcode/common/tools/list").LevelCodeToolCall<"task_update">;
274
+ trackEvent: import("@levelcode/common/types/contracts/analytics").TrackEventFn;
275
+ userId: string | undefined;
276
+ logger: import("@levelcode/common/types/contracts/logger").Logger;
267
277
  }) => Promise<{
268
278
  output: import("src").LevelCodeToolOutput<"task_update">;
269
279
  }>;
@@ -271,6 +281,9 @@ export declare const levelcodeToolHandlers: {
271
281
  previousToolCallFinished: Promise<void>;
272
282
  toolCall: import("@levelcode/common/tools/list").LevelCodeToolCall<"send_message">;
273
283
  agentStepId: string;
284
+ trackEvent: import("@levelcode/common/types/contracts/analytics").TrackEventFn;
285
+ userId: string | undefined;
286
+ logger: import("@levelcode/common/types/contracts/logger").Logger;
274
287
  }) => Promise<{
275
288
  output: import("src").LevelCodeToolOutput<"send_message">;
276
289
  }>;
@@ -278,6 +291,9 @@ export declare const levelcodeToolHandlers: {
278
291
  previousToolCallFinished: Promise<void>;
279
292
  toolCall: import("@levelcode/common/tools/list").LevelCodeToolCall<"team_create">;
280
293
  agentStepId: string;
294
+ trackEvent: import("@levelcode/common/types/contracts/analytics").TrackEventFn;
295
+ userId: string | undefined;
296
+ logger: import("@levelcode/common/types/contracts/logger").Logger;
281
297
  }) => Promise<{
282
298
  output: import("src").LevelCodeToolOutput<"team_create">;
283
299
  }>;
@@ -285,6 +301,9 @@ export declare const levelcodeToolHandlers: {
285
301
  previousToolCallFinished: Promise<void>;
286
302
  toolCall: import("@levelcode/common/tools/list").LevelCodeToolCall<"team_delete">;
287
303
  agentStepId: string;
304
+ trackEvent: import("@levelcode/common/types/contracts/analytics").TrackEventFn;
305
+ userId: string | undefined;
306
+ logger: import("@levelcode/common/types/contracts/logger").Logger;
288
307
  }) => Promise<{
289
308
  output: import("src").LevelCodeToolOutput<"team_delete">;
290
309
  }>;
@@ -1,9 +1,14 @@
1
1
  import type { LevelCodeToolCall, LevelCodeToolOutput } from '@levelcode/common/tools/list';
2
+ import type { TrackEventFn } from '@levelcode/common/types/contracts/analytics';
3
+ import type { Logger } from '@levelcode/common/types/contracts/logger';
2
4
  type ToolName = 'send_message';
3
5
  export declare const handleSendMessage: (params: {
4
6
  previousToolCallFinished: Promise<void>;
5
7
  toolCall: LevelCodeToolCall<ToolName>;
6
8
  agentStepId: string;
9
+ trackEvent: TrackEventFn;
10
+ userId: string | undefined;
11
+ logger: Logger;
7
12
  }) => Promise<{
8
13
  output: LevelCodeToolOutput<ToolName>;
9
14
  }>;
@@ -6,6 +6,7 @@ import type { Logger } from '@levelcode/common/types/contracts/logger';
6
6
  import type { ParamsExcluding, OptionalFields } from '@levelcode/common/types/function-params';
7
7
  import type { PrintModeEvent } from '@levelcode/common/types/print-mode';
8
8
  import type { AgentState, AgentTemplateType, Subgoal } from '@levelcode/common/types/session-state';
9
+ import type { TeamConfig, TeamRole } from '@levelcode/common/types/team-config';
9
10
  import type { ProjectFileContext } from '@levelcode/common/util/file';
10
11
  import type { ToolSet } from 'ai';
11
12
  /**
@@ -92,9 +93,38 @@ export interface TeamSpawnOptions {
92
93
  teamName: string;
93
94
  teamRole?: string;
94
95
  }
96
+ /**
97
+ * Resolves a team_role to the corresponding agent template ID from agents/team/.
98
+ * For example, 'coordinator' maps to the coordinator agent template,
99
+ * 'manager' maps to the manager agent template, etc.
100
+ *
101
+ * Returns the agent template ID (which is the same as the role string for
102
+ * roles that have a dedicated template), or null if no template exists for
103
+ * the given role.
104
+ */
105
+ export declare function resolveTeamRoleAgentType(teamRole: string): string | null;
106
+ /**
107
+ * Validates that the spawning agent has authority to spawn an agent
108
+ * with the requested team role.
109
+ *
110
+ * Uses canManage from role-hierarchy to check that the spawner's role
111
+ * has a strictly higher authority level than the target role.
112
+ * Also checks getSpawnableRoles to ensure the specific role combination
113
+ * is allowed.
114
+ *
115
+ * @param spawnerRole - The team role of the agent performing the spawn
116
+ * @param targetRole - The team role being requested for the new agent
117
+ * @throws Error if the spawner lacks authority
118
+ */
119
+ export declare function validateSpawnAuthority(spawnerRole: TeamRole, targetRole: TeamRole): void;
120
+ /**
121
+ * Sends a notification to the team lead when a new agent joins the team.
122
+ * This is a fire-and-forget operation; errors are logged but not thrown.
123
+ */
124
+ export declare function notifyTeamLead(teamName: string, teamConfig: TeamConfig, memberName: string, role: TeamRole, logger: Logger): Promise<void>;
95
125
  /**
96
126
  * Registers a spawned agent as a member of an existing team.
97
127
  * Returns the team context string to prepend to the agent's prompt,
98
128
  * or null if the team does not exist.
99
129
  */
100
- export declare function registerAgentAsTeamMember(agentId: string, agentType: string, options: TeamSpawnOptions, logger: Logger): string | null;
130
+ export declare function registerAgentAsTeamMember(agentId: string, agentType: string, options: TeamSpawnOptions, logger: Logger): Promise<string | null>;
@@ -1,4 +1,5 @@
1
1
  import { validateAndGetAgentTemplate, executeSubagent } from './spawn-agent-utils';
2
+ import type { TrackEventFn } from '@levelcode/common/types/contracts/analytics';
2
3
  import type { LevelCodeToolCall, LevelCodeToolOutput } from '@levelcode/common/tools/list';
3
4
  import type { AgentTemplate } from '@levelcode/common/types/agent-template';
4
5
  import type { Logger } from '@levelcode/common/types/contracts/logger';
@@ -25,6 +26,7 @@ export declare const handleSpawnAgents: (params: {
25
26
  logger: Logger;
26
27
  system: string;
27
28
  tools?: ToolSet;
29
+ trackEvent: TrackEventFn;
28
30
  userId: string | undefined;
29
31
  userInputId: string;
30
32
  sendSubagentChunk: SendSubagentChunk;
@@ -1,7 +1,15 @@
1
1
  import type { LevelCodeToolCall, LevelCodeToolOutput } from '@levelcode/common/tools/list';
2
- export declare const handleTaskCompleted: ({ previousToolCallFinished, }: {
2
+ import type { TrackEventFn } from '@levelcode/common/types/contracts/analytics';
3
+ import type { Logger } from '@levelcode/common/types/contracts/logger';
4
+ export declare const handleTaskCompleted: ({ previousToolCallFinished, trackEvent, userId, logger, agentTemplate, }: {
3
5
  previousToolCallFinished: Promise<any>;
4
6
  toolCall: LevelCodeToolCall<"task_completed">;
7
+ trackEvent: TrackEventFn;
8
+ userId: string | undefined;
9
+ logger: Logger;
10
+ agentTemplate: {
11
+ name: string;
12
+ };
5
13
  }) => Promise<{
6
14
  output: LevelCodeToolOutput<"task_completed">;
7
15
  }>;
@@ -1,8 +1,13 @@
1
1
  import type { LevelCodeToolCall, LevelCodeToolOutput } from '@levelcode/common/tools/list';
2
+ import type { TrackEventFn } from '@levelcode/common/types/contracts/analytics';
3
+ import type { Logger } from '@levelcode/common/types/contracts/logger';
2
4
  type ToolName = 'task_update';
3
5
  export declare const handleTaskUpdate: (params: {
4
6
  previousToolCallFinished: Promise<void>;
5
7
  toolCall: LevelCodeToolCall<ToolName>;
8
+ trackEvent: TrackEventFn;
9
+ userId: string | undefined;
10
+ logger: Logger;
6
11
  }) => Promise<{
7
12
  output: LevelCodeToolOutput<ToolName>;
8
13
  }>;
@@ -1,9 +1,14 @@
1
1
  import type { LevelCodeToolCall, LevelCodeToolOutput } from '@levelcode/common/tools/list';
2
+ import type { TrackEventFn } from '@levelcode/common/types/contracts/analytics';
3
+ import type { Logger } from '@levelcode/common/types/contracts/logger';
2
4
  type ToolName = 'team_create';
3
5
  export declare const handleTeamCreate: (params: {
4
6
  previousToolCallFinished: Promise<void>;
5
7
  toolCall: LevelCodeToolCall<ToolName>;
6
8
  agentStepId: string;
9
+ trackEvent: TrackEventFn;
10
+ userId: string | undefined;
11
+ logger: Logger;
7
12
  }) => Promise<{
8
13
  output: LevelCodeToolOutput<ToolName>;
9
14
  }>;
@@ -1,9 +1,14 @@
1
1
  import type { LevelCodeToolCall, LevelCodeToolOutput } from '@levelcode/common/tools/list';
2
+ import type { TrackEventFn } from '@levelcode/common/types/contracts/analytics';
3
+ import type { Logger } from '@levelcode/common/types/contracts/logger';
2
4
  type ToolName = 'team_delete';
3
5
  export declare const handleTeamDelete: (params: {
4
6
  previousToolCallFinished: Promise<void>;
5
7
  toolCall: LevelCodeToolCall<ToolName>;
6
8
  agentStepId: string;
9
+ trackEvent: TrackEventFn;
10
+ userId: string | undefined;
11
+ logger: Logger;
7
12
  }) => Promise<{
8
13
  output: LevelCodeToolOutput<ToolName>;
9
14
  }>;
@@ -0,0 +1 @@
1
+ export {};
@@ -1,5 +1,8 @@
1
1
  import type { RunOptions, LevelCodeClientOptions } from './run';
2
2
  import type { RunState } from './run-state';
3
+ import type { CreateTeamOptions, TeamStatus, RunWithTeamOptions } from './team';
4
+ import type { TeamConfig } from '@levelcode/common/types/team-config';
5
+ import type { TeamSummary } from '@levelcode/common/utils/team-discovery';
3
6
  export declare class LevelCodeClient {
4
7
  options: LevelCodeClientOptions & {
5
8
  apiKey: string;
@@ -30,4 +33,39 @@ export declare class LevelCodeClient {
30
33
  * @returns Promise that resolves to true if connected, false otherwise
31
34
  */
32
35
  checkConnection(): Promise<boolean>;
36
+ /**
37
+ * Create a new team for coordinating multiple agents.
38
+ *
39
+ * @param name - Unique name for the team.
40
+ * @param options - Optional configuration including description, phase, preset, members, and settings.
41
+ * @returns The created TeamConfig.
42
+ */
43
+ createTeam(name: string, options?: CreateTeamOptions): TeamConfig;
44
+ /**
45
+ * Delete a team and all its associated data (inboxes, tasks).
46
+ *
47
+ * @param name - Name of the team to delete.
48
+ */
49
+ deleteTeam(name: string): void;
50
+ /**
51
+ * Get the full status of a team including its config, tasks, and member count.
52
+ *
53
+ * @param name - Name of the team.
54
+ * @returns TeamStatus with config, tasks array, and memberCount.
55
+ */
56
+ getTeamStatus(name: string): TeamStatus;
57
+ /**
58
+ * List all teams with summary information (name, phase, member count).
59
+ *
60
+ * @returns Array of TeamSummary objects.
61
+ */
62
+ listTeams(): TeamSummary[];
63
+ /**
64
+ * Run an agent as part of a team. The agent will be registered as a team member
65
+ * and the run will include team context.
66
+ *
67
+ * @param options - Run options extended with teamName, memberName, and role.
68
+ * @returns A Promise that resolves to a RunState.
69
+ */
70
+ runWithTeam(options: RunWithTeamOptions): Promise<RunState>;
33
71
  }
@@ -0,0 +1,49 @@
1
+ import type { TeamConfig, TeamMember, TeamTask, DevPhase, TeamRole } from '@levelcode/common/types/team-config';
2
+ import type { TeamProtocolMessage } from '@levelcode/common/types/team-protocol';
3
+ import type { TeamSummary } from '@levelcode/common/utils/team-discovery';
4
+ import type { PresetConfig } from '@levelcode/common/utils/team-presets';
5
+ import type { RunOptions, LevelCodeClientOptions } from './run';
6
+ export type CreateTeamOptions = {
7
+ description?: string;
8
+ phase?: DevPhase;
9
+ preset?: string;
10
+ members?: Array<{
11
+ name: string;
12
+ role: TeamRole;
13
+ agentType: string;
14
+ model: string;
15
+ cwd?: string;
16
+ }>;
17
+ settings?: {
18
+ maxMembers?: number;
19
+ autoAssign?: boolean;
20
+ };
21
+ };
22
+ export type RunWithTeamOptions = RunOptions & LevelCodeClientOptions & {
23
+ teamName: string;
24
+ memberName: string;
25
+ role: TeamRole;
26
+ };
27
+ export type TeamStatus = {
28
+ config: TeamConfig;
29
+ tasks: TeamTask[];
30
+ memberCount: number;
31
+ };
32
+ /**
33
+ * Creates a new team with the given name and options.
34
+ * If a preset is specified, uses its member/settings defaults.
35
+ */
36
+ export declare function sdkCreateTeam(name: string, leadAgentId: string, options?: CreateTeamOptions): TeamConfig;
37
+ /**
38
+ * Deletes a team by name and removes all associated data.
39
+ */
40
+ export declare function sdkDeleteTeam(name: string): void;
41
+ /**
42
+ * Gets the full status of a team including config and tasks.
43
+ */
44
+ export declare function sdkGetTeamStatus(name: string): TeamStatus;
45
+ /**
46
+ * Lists all teams with summary information.
47
+ */
48
+ export declare function sdkListTeams(): TeamSummary[];
49
+ export type { TeamConfig, TeamMember, TeamTask, DevPhase, TeamRole, TeamProtocolMessage, TeamSummary, PresetConfig, };
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@levelcode/sdk",
3
3
  "private": false,
4
- "version": "0.1.0",
4
+ "version": "0.2.0",
5
5
  "description": "Official SDK for LevelCode — AI coding agent & framework",
6
6
  "license": "Apache-2.0",
7
7
  "type": "module",