@ekanos/cli 0.14.0 → 0.15.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.
@@ -1 +1 @@
1
- {"version":3,"file":"teams-api.js","sourceRoot":"","sources":["../src/teams-api.ts"],"names":[],"mappings":"AAAA,OAAO,EAEL,sBAAsB,EAEtB,+BAA+B,EAE/B,gBAAgB,EAEhB,yBAAyB,EAEzB,sBAAsB,EAGtB,sBAAsB,EAEtB,0BAA0B,EAE1B,4BAA4B,EAE5B,4BAA4B,EAE5B,oBAAoB,EAEpB,sBAAsB,EAEtB,eAAe,EAEf,2BAA2B,EAE3B,8BAA8B,EAE9B,cAAc,EAEd,2BAA2B,GAC5B,MAAM,4BAA4B,CAAC;AAGpC,OAAO,EAAE,OAAO,EAAE,MAAM,mBAAmB,CAAC;AAC5C,OAAO,EACL,iBAAiB,EACjB,cAAc,EACd,iBAAiB,EACjB,YAAY,EACZ,aAAa,EACb,UAAU,EACV,eAAe,GAChB,MAAM,UAAU,CAAC;AAyClB,MAAM,UAAU,SAAS,CACvB,IAAY,EACZ,WAAmB,EACnB,MAAc;IAEd,OAAO,IAAI,CAAC,IAAI,EAAE,WAAW,EAAE,cAAc,EAAE;QAC7C,MAAM,EAAE,KAAK;QACb,IAAI,EAAE,oBAAoB;QAC1B,MAAM;KACP,CAAC,CAAC;AACL,CAAC;AAED,MAAM,UAAU,mBAAmB,CACjC,IAAY,EACZ,WAAmB,EACnB,MAAyD;IAEzD,OAAO,IAAI,CAAC,IAAI,EAAE,WAAW,EAAE,2BAA2B,EAAE;QAC1D,MAAM,EAAE,KAAK;QACb,IAAI,EAAE,eAAe,CAAC,MAAM,CAAC;QAC7B,MAAM,EAAE,MAAM,CAAC,MAAM;KACtB,CAAC,CAAC;AACL,CAAC;AAED,MAAM,UAAU,UAAU,CACxB,IAAY,EACZ,WAAmB,EACnB,MAAyD,EACzD,IAIC;IAED,OAAO,IAAI,CAAC,IAAI,EAAE,WA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I,CAAC,IAAI,CAAC,CAAC;IAC3C,IAAI,CAAC,MAAM,CAAC,OAAO,EAAE,CAAC;QACpB,MAAM,YAAY,CAChB,GAAG,IAAI,gEAAgE,EACvE,6EAA6E,CAC9E,CAAC;IACJ,CAAC;IACD,OAAO,EAAE,MAAM,EAAE,IAAI,EAAE,IAAI,EAAE,MAAM,CAAC,IAAI,EAAE,CAAC;AAC7C,CAAC;AAED,KAAK,UAAU,gBAAgB,CAC7B,QAAkB;IAElB,IAAI,CAAC;QACH,MAAM,MAAM,GAAY,MAAM,QAAQ,CAAC,IAAI,EAAE,CAAC;QAC9C,OAAO,OAAO,MAAM,KAAK,QAAQ,IAAI,MAAM,KAAK,IAAI;YAClD,CAAC,CAAE,MAAkC;YACrC,CAAC,CAAC,EAAE,CAAC;IACT,CAAC;eAAO,CAAC;QACP,OAAO,EAAE,CAAC;IACZ,CAAC;AACH,CAAC","sourcesContent":["import {\n type ProductScopeList,\n ProductScopeListSchema,\n type ProductScopeProductChange,\n ProductScopeProductChangeSchema,\n type TeamScopes,\n TeamScopesSchema,\n type TeamScopesSetResult,\n TeamScopesSetResultSchema,\n type TeamAppSetResult,\n TeamAppSetResultSchema,\n type TeamCreateRequest,\n type TeamCreateResult,\n TeamCreateResultSchema,\n type TeamDisconnectResult,\n TeamDisconnectResultSchema,\n type TeamMemberChangeResult,\n TeamMemberChangeResultSchema,\n type TeamMemberInviteResult,\n TeamMemberInviteResultSchema,\n type TeamMemberList,\n TeamMemberListSchema,\n type TeamRenameResult,\n TeamRenameResultSchema,\n type TeamRoles,\n TeamRolesSchema,\n type TeamIntegrationStatus,\n TeamIntegrationStatusSchema,\n type TeamIntegrationEventList,\n TeamIntegrationEventListSchema,\n type TeamList,\n TeamListSchema,\n type TeamWebhookMintResult,\n TeamWebhookMintResultSchema,\n} from '@ekanos/integration-schema';\nimport type { z } from 'zod';\n\nimport { request } from './auth/ekanos-api';\nimport {\n authRequiredError,\n forbiddenError,\n invalidStateError,\n networkError,\n notFoundError,\n usageError,\n validationError,\n} from './errors';\n\n/**\n * The CLI's client for a Source's teams and their integration setup — the\n * team-level counterpart of `apps-api.ts`.\n *\n * GET /api/partner/teams?source=<slug> → TeamList\n * GET /api/partner/teams/<team>/integrations/<product>?source=<slug> → TeamIntegrationStatus\n * PUT …/integrations/<product>/app?source=<slug> { connectionId?, fields }\n * → TeamAppSetResult\n * POST …/integrations/<product>/webhooks/<id>?source=<slug> → TeamWebhookMintResult\n * DELETE /api/partner/teams/<team>/integrations/<product>?source=<slug> → TeamDisconnectResult\n * POST /api/partner/teams?source=<slug> { name, slug?, ownerEmail? } → TeamCreateResult\n * PATCH /api/partner/teams/<team>?source=<slug> { name } → TeamRenameResult\n * GET /api/partner/teams/<team>/members?source=<slug> → TeamMemberList\n * POST …/<team>/members?source=<slug> { email, role } → TeamMemberInviteResult\n * PATCH …/<team>/members/<email>?source=<slug> { role } → TeamMemberChangeResult\n * DELETE …/<team>/members/<email>?source=<slug> → TeamMemberChangeResult\n * GET /api/partner/teams/<team>/roles?source=<slug> → TeamRoles\n * GET /api/partner/teams/<team>/events?source=<slug>[&product=<slug>]\n * [&since=<iso>][&limit=<n>] → TeamIntegrationEventList\n * GET /api/partner/scopes?source=<slug> → ProductScopeList\n * PUT | DELETE /api/partner/scopes/<scope>/products/<product>?source=<slug>\n * → ProductScopeProductChange\n * GET /api/partner/teams/<team>/scopes?source=<slug> → TeamScopes\n * PUT /api/partner/teams/<team>/scopes?source=<slug> { scopes } → TeamScopesSetResult\n *\n * → 401 / 3xx refresh once and retry\n * → 403 { code: \"SOURCE_ADMIN_REQUIRED\" | \"MFA_REQUIRED\" | \"FORBIDDEN\" }\n * → 404 { code: \"TEAM_NOT_FOUND\" | \"PRODUCT_NOT_ENTITLED\" | \"WEBHOOK_NOT_FOUND\"\n * | \"CONNECTION_NOT_FOUND\" | \"SOURCE_NOT_FOUND\" }\n * | \"MEMBER_NOT_FOUND\" }\n * → 409 { code: \"NO_TEAM_APP\" | \"SLUG_TAKEN\" | \"TEAM_ACCOUNTS_DISABLED\"\n * | \"ALREADY_MEMBER\" | \"ALREADY_INVITED\" | \"PRIMARY_OWNER\" }\n * → 400 { code: \"INVALID_FIELDS\" | \"INVALID_REQUEST\" | \"UNKNOWN_ROLE\" }\n */\n\nexport type TeamsApiResult<T> =\n | { status: 'ok'; data: T }\n | { status: 'unauthorized' };\n\nexport function listTeams(\n host: string,\n accessToken: string,\n source: string,\n): Promise<TeamsApiResult<TeamList>> {\n return call(host, accessToken, TeamListSchema, {\n method: 'GET',\n path: '/api/partner/teams',\n source,\n });\n}\n\nexport function showTeamIntegration(\n host: string,\n accessToken: string,\n target: { source: string; team: string; product: string },\n): Promise<TeamsApiResult<TeamIntegrationStatus>> {\n return call(host, accessToken, TeamIntegrationStatusSchema, {\n method: 'GET',\n path: integrationPath(target),\n source: target.source,\n });\n}\n\nexport function setTeamApp(\n host: string,\n accessToken: string,\n target: { source: string; team: string; product: string },\n body: {\n connectionId?: string;\n fields: Record<string, string>;\n clear?: string[];\n },\n): Promise<TeamsApiResult<TeamAppSetResult>> {\n return call(host, accessToken, TeamAppSetResultSchema, {\n method: 'PUT',\n path: `${integrationPath(target)}/app`,\n source: target.source,\n body,\n });\n}\n\nexport function mintTeamWebhook(\n host: string,\n accessToken: string,\n target: { source: string; team: string; product: string },\n webhookId: string,\n): Promise<TeamsApiResult<TeamWebhookMintResult>> {\n return call(host, accessToken, TeamWebhookMintResultSchema, {\n method: 'POST',\n path: `${integrationPath(target)}/webhooks/${encodeURIComponent(webhookId)}`,\n source: target.source,\n });\n}\n\nexport function disconnectTeamIntegration(\n host: string,\n accessToken: string,\n target: { source: string; team: string; product: string },\n): Promise<TeamsApiResult<TeamDisconnectResult>> {\n return call(host, accessToken, TeamDisconnectResultSchema, {\n method: 'DELETE',\n path: integrationPath(target),\n source: target.source,\n });\n}\n\nexport function createTeam(\n host: string,\n accessToken: string,\n source: string,\n body: TeamCreateRequest,\n): Promise<TeamsApiResult<TeamCreateResult>> {\n return call(host, accessToken, TeamCreateResultSchema, {\n method: 'POST',\n path: '/api/partner/teams',\n source,\n body,\n });\n}\n\nexport function renameTeam(\n host: string,\n accessToken: string,\n target: { source: string; team: string },\n name: string,\n): Promise<TeamsApiResult<TeamRenameResult>> {\n return call(host, accessToken, TeamRenameResultSchema, {\n method: 'PATCH',\n path: `/api/partner/teams/${encodeURIComponent(target.team)}`,\n source: target.source,\n body: { name },\n });\n}\n\nexport function listTeamMembers(\n host: string,\n accessToken: string,\n target: { source: string; team: string },\n): Promise<TeamsApiResult<TeamMemberList>> {\n return call(host, accessToken, TeamMemberListSchema, {\n method: 'GET',\n path: membersPath(target.team),\n source: target.source,\n });\n}\n\nexport function inviteTeamMember(\n host: string,\n accessToken: string,\n target: { source: string; team: string },\n body: { email: string; role: string },\n): Promise<TeamsApiResult<TeamMemberInviteResult>> {\n return call(host, accessToken, TeamMemberInviteResultSchema, {\n method: 'POST',\n path: membersPath(target.team),\n source: target.source,\n body,\n });\n}\n\nexport function setTeamMemberRole(\n host: string,\n accessToken: string,\n target: { source: string; team: string; email: string },\n role: string,\n): Promise<TeamsApiResult<TeamMemberChangeResult>> {\n return call(host, accessToken, TeamMemberChangeResultSchema, {\n method: 'PATCH',\n path: `${membersPath(target.team)}/${encodeURIComponent(target.email)}`,\n source: target.source,\n body: { role },\n });\n}\n\nexport function removeTeamMember(\n host: string,\n accessToken: string,\n target: { source: string; team: string; email: string },\n): Promise<TeamsApiResult<TeamMemberChangeResult>> {\n return call(host, accessToken, TeamMemberChangeResultSchema, {\n method: 'DELETE',\n path: `${membersPath(target.team)}/${encodeURIComponent(target.email)}`,\n source: target.source,\n });\n}\n\nexport function listProductScopes(\n host: string,\n accessToken: string,\n source: string,\n): Promise<TeamsApiResult<ProductScopeList>> {\n return call(host, accessToken, ProductScopeListSchema, {\n method: 'GET',\n path: '/api/partner/scopes',\n source,\n });\n}\n\nexport function setScopeProduct(\n host: string,\n accessToken: string,\n target: { source: string; scope: string; product: string },\n included: boolean,\n): Promise<TeamsApiResult<ProductScopeProductChange>> {\n return call(host, accessToken, ProductScopeProductChangeSchema, {\n method: included ? 'PUT' : 'DELETE',\n path: `/api/partner/scopes/${encodeURIComponent(target.scope)}/products/${encodeURIComponent(target.product)}`,\n source: target.source,\n });\n}\n\nexport function showTeamScopes(\n host: string,\n accessToken: string,\n target: { source: string; team: string },\n): Promise<TeamsApiResult<TeamScopes>> {\n return call(host, accessToken, TeamScopesSchema, {\n method: 'GET',\n path: `/api/partner/teams/${encodeURIComponent(target.team)}/scopes`,\n source: target.source,\n });\n}\n\nexport function setTeamScopes(\n host: string,\n accessToken: string,\n target: { source: string; team: string },\n scopes: string[],\n): Promise<TeamsApiResult<TeamScopesSetResult>> {\n return call(host, accessToken, TeamScopesSetResultSchema, {\n method: 'PUT',\n path: `/api/partner/teams/${encodeURIComponent(target.team)}/scopes`,\n source: target.source,\n body: { scopes },\n });\n}\n\nexport function listTeamRoles(\n host: string,\n accessToken: string,\n target: { source: string; team: string },\n): Promise<TeamsApiResult<TeamRoles>> {\n return call(host, accessToken, TeamRolesSchema, {\n method: 'GET',\n path: `/api/partner/teams/${encodeURIComponent(target.team)}/roles`,\n source: target.source,\n });\n}\n\nexport function listTeamEvents(\n host: string,\n accessToken: string,\n target: { source: string; team: string },\n filters: { product?: string; since?: string; limit?: number },\n): Promise<TeamsApiResult<TeamIntegrationEventList>> {\n const query = new URLSearchParams();\n if (filters.product) query.set('product', filters.product);\n if (filters.since) query.set('since', filters.since);\n if (filters.limit !== undefined) query.set('limit', String(filters.limit));\n const encoded = query.toString();\n const suffix = encoded ? `?${encoded}` : '';\n return call(host, accessToken, TeamIntegrationEventListSchema, {\n method: 'GET',\n path: `/api/partner/teams/${encodeURIComponent(target.team)}/events${suffix}`,\n source: target.source,\n });\n}\n\nfunction membersPath(team: string): string {\n return `/api/partner/teams/${encodeURIComponent(team)}/members`;\n}\n\nfunction integrationPath(target: { team: string; product: string }): string {\n return `/api/partner/teams/${encodeURIComponent(target.team)}/integrations/${encodeURIComponent(target.product)}`;\n}\n\n/** One partner teams call; shared by the team-agent clients (`team-agents-api.ts`). */\nexport async function call<T>(\n host: string,\n accessToken: string,\n schema: z.ZodType<T>,\n init: {\n method: 'GET' | 'PUT' | 'POST' | 'PATCH' | 'DELETE';\n path: string;\n source: string;\n body?: unknown;\n },\n): Promise<TeamsApiResult<T>> {\n const response = await request(\n `${host}${init.path}${init.path.includes('?') ? '&' : '?'}${new URLSearchParams({ source: init.source })}`,\n {\n method: init.method,\n headers: {\n accept: 'application/json',\n authorization: `Bearer ${accessToken}`,\n ...(init.body === undefined\n ? {}\n : { 'content-type': 'application/json' }),\n },\n body: init.body === undefined ? undefined : JSON.stringify(init.body),\n },\n );\n\n if (\n response.status === 401 ||\n (response.status >= 300 && response.status < 400)\n ) {\n return { status: 'unauthorized' };\n }\n\n const body = await readOptionalJson(response);\n const code = typeof body.code === 'string' ? body.code : null;\n const message =\n typeof body.error === 'string' && body.error ? body.error : null;\n\n if (response.status === 403 && code === 'MFA_REQUIRED') {\n throw authRequiredError(\n message ?? `${host} requires multi-factor authentication.`,\n 'Complete MFA in the browser, then run \"ekanos login\" again.',\n );\n }\n if (response.status === 403) {\n throw forbiddenError(\n message ?? 'Not permitted on this Source.',\n code === 'SOURCE_ADMIN_REQUIRED'\n ? \"Only a Source admin manages its teams' integrations. Ask one to run it.\"\n : code === 'NOT_RUNS_AS'\n ? 'Consent is personal: the person it runs as gives it, signed in as themselves. \"ekanos teams agents list <team>\" shows who that is.'\n : code === 'AGENTS_MANAGE_REQUIRED'\n ? 'Ask a team owner for a role that manages agents, then confirm again.'\n : 'Run \"ekanos sources\" to list the sources you hold a seat on.',\n );\n }\n if (response.status === 404) {\n throw notFoundError(\n message ?? 'Not found.',\n code === 'TEAM_NOT_FOUND'\n ? 'Run \"ekanos teams list\" to see the teams on this Source.'\n : code === 'PRODUCT_NOT_ENTITLED'\n ? '\"ekanos sources products\" shows what this Source has; only a super-admin enables a product for a Source (in /admin).'\n : code === 'SCOPE_NOT_FOUND' || code === 'PRODUCT_NOT_IN_SCOPE'\n ? 'Run \"ekanos sources scopes\" to see the Source\\'s product scopes and their products.'\n : code === 'WEBHOOK_NOT_FOUND' || code === 'CONNECTION_NOT_FOUND'\n ? 'Run \"ekanos teams show <team> <product>\" to see its team apps and webhooks.'\n : code === 'MEMBER_NOT_FOUND'\n ? 'Run \"ekanos teams members list <team>\" to see its members and invitations.'\n : code === 'SKILL_NOT_FOUND'\n ? 'Run \"ekanos skills list --team <team>\" (and \"ekanos skills list\") to see the skills this team can use.'\n : code?.startsWith('AGENT_') || code === 'TEMPLATE_NOT_FOUND'\n ? 'Run \"ekanos teams agents list <team>\" to see the team\\'s agents.'\n : /^(TRIGGER|LINK|MCP)_/.test(code ?? '')\n ? 'List them first: \"ekanos teams triggers|links|mcp list <team> ...\"'\n : 'Run \"ekanos sources\" to list the sources you hold a seat on.',\n );\n }\n if (response.status === 409 && code === 'NO_TEAM_APP') {\n throw invalidStateError(\n message ?? 'This integration takes no team app.',\n 'Teams connect through the Source\\'s app: \"ekanos apps show <product>\".',\n );\n }\n if (response.status === 409 || response.status === 422) {\n throw invalidStateError(\n message ?? 'The host refused the change.',\n code === 'SLUG_TAKEN'\n ? 'Pick another with --slug, or run \"ekanos teams list\" to see the teams.'\n : code === 'AGENT_VERSION_CHANGED'\n ? 'A newer version was published since it was shown to you. Review it with \"ekanos teams agents show <team> <key>\", then run \"ekanos teams agents confirm\" again.'\n : code === 'ALREADY_MEMBER' || code === 'ALREADY_INVITED'\n ? 'Run \"ekanos teams members list <team>\"; change a role with \"ekanos teams members role <team> <email> <role>\".'\n : code === 'PRIMARY_OWNER'\n ? \"The primary owner's ownership is transferred in the app (team Settings → Members).\"\n : code === 'TEAM_ACCOUNTS_DISABLED'\n ? 'Ekanos switches team accounts on for a Source; ask a super-admin.'\n : code === 'PERSONAL_CONNECTION'\n ? \"The member who made it disconnects it on the team's Integrations page in the app.\"\n : code === 'MCP_SERVER_FROM_TEMPLATE'\n ? 'It stays while the agent template declares it: change the template, apply and publish.'\n : code === 'PRODUCT_NOT_ENTITLED'\n ? '\"ekanos sources products\" shows what this Source has; only those can be in its scopes.'\n : code === 'TEMPLATE_ARCHIVED'\n ? 'Unarchive it first: \"ekanos agents unarchive <key>\".'\n : 'See \"ekanos teams --help\".',\n );\n }\n if (response.status === 400 && code === 'UNKNOWN_ROLE') {\n throw validationError(\n message ?? 'No such role.',\n 'Run \"ekanos teams roles list <team>\" for the roles this Source uses.',\n );\n }\n if (response.status === 400 && code === 'INVALID_FIELDS') {\n throw validationError(\n message ?? 'The host refused the fields.',\n 'Run \"ekanos teams app set <team> <product>\" again.',\n );\n }\n if (response.status === 400) {\n throw usageError(\n message ?? 'The host refused the request.',\n 'See \"ekanos teams --help\".',\n );\n }\n if (!response.ok) {\n throw networkError(\n `${host}${init.path} responded ${response.status}.`,\n response.status >= 500\n ? 'The Ekanos deployment returned a server error. Retry shortly.'\n : 'Confirm the host runs a build that includes the teams routes.',\n );\n }\n\n const parsed = schema.safeParse(body.data);\n if (!parsed.success) {\n throw networkError(\n `${host}/api/partner/teams answered in a shape this CLI does not read.`,\n 'Run \"ekanos upgrade\" — the CLI and the host disagree on the teams contract.',\n );\n }\n return { status: 'ok', data: parsed.data };\n}\n\nasync function readOptionalJson(\n response: Response,\n): Promise<Record<string, unknown>> {\n try {\n const parsed: unknown = await response.json();\n return typeof parsed === 'object' && parsed !== null\n ? (parsed as Record<string, unknown>)\n : {};\n } catch {\n return {};\n }\n}\n"]}
1
+ {"version":3,"file":"teams-api.js","sourceRoot":"","sources":["../src/teams-api.ts"],"names":[],"mappings":"AAAA,OAAO,EAEL,sBAAsB,EAEtB,+BAA+B,EAE/B,gBAAgB,EAEhB,yBAAyB,EAEzB,sBAAsB,EAGtB,sBAAsB,EAEtB,0BAA0B,EAE1B,4BAA4B,EAE5B,4BAA4B,EAE5B,oBAAoB,EAEpB,sBAAsB,EAEtB,eAAe,EAEf,2BAA2B,EAE3B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CAAC,EAAE,CAAC;IACT,CAAC;eAAO,CAAC;QACP,OAAO,EAAE,CAAC;IACZ,CAAC;AACH,CAAC","sourcesContent":["import {\n type ProductScopeList,\n ProductScopeListSchema,\n type ProductScopeProductChange,\n ProductScopeProductChangeSchema,\n type TeamScopes,\n TeamScopesSchema,\n type TeamScopesSetResult,\n TeamScopesSetResultSchema,\n type TeamAppSetResult,\n TeamAppSetResultSchema,\n type TeamCreateRequest,\n type TeamCreateResult,\n TeamCreateResultSchema,\n type TeamDisconnectResult,\n TeamDisconnectResultSchema,\n type TeamMemberChangeResult,\n TeamMemberChangeResultSchema,\n type TeamMemberInviteResult,\n TeamMemberInviteResultSchema,\n type TeamMemberList,\n TeamMemberListSchema,\n type TeamRenameResult,\n TeamRenameResultSchema,\n type TeamRoles,\n TeamRolesSchema,\n type TeamIntegrationStatus,\n TeamIntegrationStatusSchema,\n type TeamIntegrationEventList,\n TeamIntegrationEventListSchema,\n type TeamList,\n TeamListSchema,\n type TeamWebhookMintResult,\n TeamWebhookMintResultSchema,\n} from '@ekanos/integration-schema';\nimport type { z } from 'zod';\n\nimport { request } from './auth/ekanos-api';\nimport {\n authRequiredError,\n forbiddenError,\n invalidStateError,\n networkError,\n notFoundError,\n usageError,\n validationError,\n} from './errors';\n\n/**\n * The CLI's client for a Source's teams and their integration setup — the\n * team-level counterpart of `apps-api.ts`.\n *\n * GET /api/partner/teams?source=<slug> → TeamList\n * GET /api/partner/teams/<team>/integrations/<product>?source=<slug> → TeamIntegrationStatus\n * PUT …/integrations/<product>/app?source=<slug> { connectionId?, fields }\n * → TeamAppSetResult\n * POST …/integrations/<product>/webhooks/<id>?source=<slug> → TeamWebhookMintResult\n * DELETE /api/partner/teams/<team>/integrations/<product>?source=<slug> → TeamDisconnectResult\n * POST /api/partner/teams?source=<slug> { name, slug?, ownerEmail? } → TeamCreateResult\n * PATCH /api/partner/teams/<team>?source=<slug> { name } → TeamRenameResult\n * GET /api/partner/teams/<team>/members?source=<slug> → TeamMemberList\n * POST …/<team>/members?source=<slug> { email, role } → TeamMemberInviteResult\n * PATCH …/<team>/members/<email>?source=<slug> { role } → TeamMemberChangeResult\n * DELETE …/<team>/members/<email>?source=<slug> → TeamMemberChangeResult\n * GET /api/partner/teams/<team>/roles?source=<slug> → TeamRoles\n * GET /api/partner/teams/<team>/events?source=<slug>[&product=<slug>]\n * [&since=<iso>][&limit=<n>] → TeamIntegrationEventList\n * GET /api/partner/scopes?source=<slug> → ProductScopeList\n * PUT | DELETE /api/partner/scopes/<scope>/products/<product>?source=<slug>\n * → ProductScopeProductChange\n * GET /api/partner/teams/<team>/scopes?source=<slug> → TeamScopes\n * PUT /api/partner/teams/<team>/scopes?source=<slug> { scopes } → TeamScopesSetResult\n *\n * → 401 / 3xx refresh once and retry\n * → 403 { code: \"SOURCE_ADMIN_REQUIRED\" | \"MFA_REQUIRED\" | \"FORBIDDEN\" }\n * → 404 { code: \"TEAM_NOT_FOUND\" | \"PRODUCT_NOT_ENTITLED\" | \"WEBHOOK_NOT_FOUND\"\n * | \"CONNECTION_NOT_FOUND\" | \"SOURCE_NOT_FOUND\" }\n * | \"MEMBER_NOT_FOUND\" }\n * → 409 { code: \"NO_TEAM_APP\" | \"SLUG_TAKEN\" | \"TEAM_ACCOUNTS_DISABLED\"\n * | \"ALREADY_MEMBER\" | \"ALREADY_INVITED\" | \"PRIMARY_OWNER\" }\n * → 400 { code: \"INVALID_FIELDS\" | \"INVALID_REQUEST\" | \"UNKNOWN_ROLE\" }\n */\n\nexport type TeamsApiResult<T> =\n | { status: 'ok'; data: T }\n | { status: 'unauthorized' };\n\nexport function listTeams(\n host: string,\n accessToken: string,\n source: string,\n): Promise<TeamsApiResult<TeamList>> {\n return call(host, accessToken, TeamListSchema, {\n method: 'GET',\n path: '/api/partner/teams',\n source,\n });\n}\n\nexport function showTeamIntegration(\n host: string,\n accessToken: string,\n target: { source: string; team: string; product: string },\n): Promise<TeamsApiResult<TeamIntegrationStatus>> {\n return call(host, accessToken, TeamIntegrationStatusSchema, {\n method: 'GET',\n path: integrationPath(target),\n source: target.source,\n });\n}\n\nexport function setTeamApp(\n host: string,\n accessToken: string,\n target: { source: string; team: string; product: string },\n body: {\n connectionId?: string;\n fields: Record<string, string>;\n clear?: string[];\n },\n): Promise<TeamsApiResult<TeamAppSetResult>> {\n return call(host, accessToken, TeamAppSetResultSchema, {\n method: 'PUT',\n path: `${integrationPath(target)}/app`,\n source: target.source,\n body,\n });\n}\n\nexport function mintTeamWebhook(\n host: string,\n accessToken: string,\n target: { source: string; team: string; product: string },\n webhookId: string,\n): Promise<TeamsApiResult<TeamWebhookMintResult>> {\n return call(host, accessToken, TeamWebhookMintResultSchema, {\n method: 'POST',\n path: `${integrationPath(target)}/webhooks/${encodeURIComponent(webhookId)}`,\n source: target.source,\n });\n}\n\nexport function disconnectTeamIntegration(\n host: string,\n accessToken: string,\n target: { source: string; team: string; product: string },\n): Promise<TeamsApiResult<TeamDisconnectResult>> {\n return call(host, accessToken, TeamDisconnectResultSchema, {\n method: 'DELETE',\n path: integrationPath(target),\n source: target.source,\n });\n}\n\nexport function createTeam(\n host: string,\n accessToken: string,\n source: string,\n body: TeamCreateRequest,\n): Promise<TeamsApiResult<TeamCreateResult>> {\n return call(host, accessToken, TeamCreateResultSchema, {\n method: 'POST',\n path: '/api/partner/teams',\n source,\n body,\n });\n}\n\nexport function renameTeam(\n host: string,\n accessToken: string,\n target: { source: string; team: string },\n name: string,\n): Promise<TeamsApiResult<TeamRenameResult>> {\n return call(host, accessToken, TeamRenameResultSchema, {\n method: 'PATCH',\n path: `/api/partner/teams/${encodeURIComponent(target.team)}`,\n source: target.source,\n body: { name },\n });\n}\n\nexport function listTeamMembers(\n host: string,\n accessToken: string,\n target: { source: string; team: string },\n): Promise<TeamsApiResult<TeamMemberList>> {\n return call(host, accessToken, TeamMemberListSchema, {\n method: 'GET',\n path: membersPath(target.team),\n source: target.source,\n });\n}\n\nexport function inviteTeamMember(\n host: string,\n accessToken: string,\n target: { source: string; team: string },\n body: { email: string; role: string },\n): Promise<TeamsApiResult<TeamMemberInviteResult>> {\n return call(host, accessToken, TeamMemberInviteResultSchema, {\n method: 'POST',\n path: membersPath(target.team),\n source: target.source,\n body,\n });\n}\n\nexport function setTeamMemberRole(\n host: string,\n accessToken: string,\n target: { source: string; team: string; email: string },\n role: string,\n): Promise<TeamsApiResult<TeamMemberChangeResult>> {\n return call(host, accessToken, TeamMemberChangeResultSchema, {\n method: 'PATCH',\n path: `${membersPath(target.team)}/${encodeURIComponent(target.email)}`,\n source: target.source,\n body: { role },\n });\n}\n\nexport function removeTeamMember(\n host: string,\n accessToken: string,\n target: { source: string; team: string; email: string },\n): Promise<TeamsApiResult<TeamMemberChangeResult>> {\n return call(host, accessToken, TeamMemberChangeResultSchema, {\n method: 'DELETE',\n path: `${membersPath(target.team)}/${encodeURIComponent(target.email)}`,\n source: target.source,\n });\n}\n\nexport function listProductScopes(\n host: string,\n accessToken: string,\n source: string,\n): Promise<TeamsApiResult<ProductScopeList>> {\n return call(host, accessToken, ProductScopeListSchema, {\n method: 'GET',\n path: '/api/partner/scopes',\n source,\n });\n}\n\nexport function setScopeProduct(\n host: string,\n accessToken: string,\n target: { source: string; scope: string; product: string },\n included: boolean,\n): Promise<TeamsApiResult<ProductScopeProductChange>> {\n return call(host, accessToken, ProductScopeProductChangeSchema, {\n method: included ? 'PUT' : 'DELETE',\n path: `/api/partner/scopes/${encodeURIComponent(target.scope)}/products/${encodeURIComponent(target.product)}`,\n source: target.source,\n });\n}\n\nexport function showTeamScopes(\n host: string,\n accessToken: string,\n target: { source: string; team: string },\n): Promise<TeamsApiResult<TeamScopes>> {\n return call(host, accessToken, TeamScopesSchema, {\n method: 'GET',\n path: `/api/partner/teams/${encodeURIComponent(target.team)}/scopes`,\n source: target.source,\n });\n}\n\nexport function setTeamScopes(\n host: string,\n accessToken: string,\n target: { source: string; team: string },\n scopes: string[],\n): Promise<TeamsApiResult<TeamScopesSetResult>> {\n return call(host, accessToken, TeamScopesSetResultSchema, {\n method: 'PUT',\n path: `/api/partner/teams/${encodeURIComponent(target.team)}/scopes`,\n source: target.source,\n body: { scopes },\n });\n}\n\nexport function listTeamRoles(\n host: string,\n accessToken: string,\n target: { source: string; team: string },\n): Promise<TeamsApiResult<TeamRoles>> {\n return call(host, accessToken, TeamRolesSchema, {\n method: 'GET',\n path: `/api/partner/teams/${encodeURIComponent(target.team)}/roles`,\n source: target.source,\n });\n}\n\nexport function listTeamEvents(\n host: string,\n accessToken: string,\n target: { source: string; team: string },\n filters: { product?: string; since?: string; limit?: number },\n): Promise<TeamsApiResult<TeamIntegrationEventList>> {\n const query = new URLSearchParams();\n if (filters.product) query.set('product', filters.product);\n if (filters.since) query.set('since', filters.since);\n if (filters.limit !== undefined) query.set('limit', String(filters.limit));\n const encoded = query.toString();\n const suffix = encoded ? `?${encoded}` : '';\n return call(host, accessToken, TeamIntegrationEventListSchema, {\n method: 'GET',\n path: `/api/partner/teams/${encodeURIComponent(target.team)}/events${suffix}`,\n source: target.source,\n });\n}\n\nfunction membersPath(team: string): string {\n return `/api/partner/teams/${encodeURIComponent(team)}/members`;\n}\n\nfunction integrationPath(target: { team: string; product: string }): string {\n return `/api/partner/teams/${encodeURIComponent(target.team)}/integrations/${encodeURIComponent(target.product)}`;\n}\n\n/** One partner teams call; shared by the team-agent clients (`team-agents-api.ts`). */\nexport async function call<T>(\n host: string,\n accessToken: string,\n schema: z.ZodType<T>,\n init: {\n method: 'GET' | 'PUT' | 'POST' | 'PATCH' | 'DELETE';\n path: string;\n source: string;\n body?: unknown;\n },\n): Promise<TeamsApiResult<T>> {\n const response = await request(\n `${host}${init.path}${init.path.includes('?') ? '&' : '?'}${new URLSearchParams({ source: init.source })}`,\n {\n method: init.method,\n headers: {\n accept: 'application/json',\n authorization: `Bearer ${accessToken}`,\n ...(init.body === undefined\n ? {}\n : { 'content-type': 'application/json' }),\n },\n body: init.body === undefined ? undefined : JSON.stringify(init.body),\n },\n );\n\n if (\n response.status === 401 ||\n (response.status >= 300 && response.status < 400)\n ) {\n return { status: 'unauthorized' };\n }\n\n const body = await readOptionalJson(response);\n const code = typeof body.code === 'string' ? body.code : null;\n const message =\n typeof body.error === 'string' && body.error ? body.error : null;\n\n if (response.status === 403 && code === 'MFA_REQUIRED') {\n throw authRequiredError(\n message ?? `${host} requires multi-factor authentication.`,\n 'Complete MFA in the browser, then run \"ekanos login\" again.',\n );\n }\n if (response.status === 403) {\n throw forbiddenError(\n message ?? 'Not permitted on this Source.',\n code === 'SOURCE_ADMIN_REQUIRED'\n ? \"Only a Source admin manages its teams' integrations. Ask one to run it.\"\n : code === 'CONFIRM_NOT_PERMITTED'\n ? \"Only a Source admin of the team's Source, or someone who manages the team's agents, confirms what an agent may use.\"\n : 'Run \"ekanos sources\" to list the sources you hold a seat on.',\n );\n }\n if (response.status === 404) {\n throw notFoundError(\n message ?? 'Not found.',\n code === 'TEAM_NOT_FOUND'\n ? 'Run \"ekanos teams list\" to see the teams on this Source.'\n : code === 'PRODUCT_NOT_ENTITLED'\n ? '\"ekanos sources products\" shows what this Source has; only a super-admin enables a product for a Source (in /admin).'\n : code === 'SCOPE_NOT_FOUND' || code === 'PRODUCT_NOT_IN_SCOPE'\n ? 'Run \"ekanos sources scopes\" to see the Source\\'s product scopes and their products.'\n : code === 'WEBHOOK_NOT_FOUND' || code === 'CONNECTION_NOT_FOUND'\n ? 'Run \"ekanos teams show <team> <product>\" to see its team apps and webhooks.'\n : code === 'MEMBER_NOT_FOUND'\n ? 'Run \"ekanos teams members list <team>\" to see its members and invitations.'\n : code === 'SKILL_NOT_FOUND'\n ? 'Run \"ekanos skills list --team <team>\" (and \"ekanos skills list\") to see the skills this team can use.'\n : code?.startsWith('AGENT_') || code === 'TEMPLATE_NOT_FOUND'\n ? 'Run \"ekanos teams agents list <team>\" to see the team\\'s agents.'\n : /^(TRIGGER|LINK|MCP)_/.test(code ?? '')\n ? 'List them first: \"ekanos teams triggers|links|mcp list <team> ...\"'\n : 'Run \"ekanos sources\" to list the sources you hold a seat on.',\n );\n }\n if (response.status === 409 && code === 'NO_TEAM_APP') {\n throw invalidStateError(\n message ?? 'This integration takes no team app.',\n 'Teams connect through the Source\\'s app: \"ekanos apps show <product>\".',\n );\n }\n if (response.status === 409 || response.status === 422) {\n throw invalidStateError(\n message ?? 'The host refused the change.',\n code === 'SLUG_TAKEN'\n ? 'Pick another with --slug, or run \"ekanos teams list\" to see the teams.'\n : code === 'AGENT_VERSION_CHANGED'\n ? 'A newer version was published since it was shown to you. Review it with \"ekanos teams agents show <team> <key>\", then run \"ekanos teams agents confirm\" again.'\n : code === 'ALREADY_MEMBER' || code === 'ALREADY_INVITED'\n ? 'Run \"ekanos teams members list <team>\"; change a role with \"ekanos teams members role <team> <email> <role>\".'\n : code === 'PRIMARY_OWNER'\n ? \"The primary owner's ownership is transferred in the app (team Settings → Members).\"\n : code === 'TEAM_ACCOUNTS_DISABLED'\n ? 'Ekanos switches team accounts on for a Source; ask a super-admin.'\n : code === 'PERSONAL_CONNECTION'\n ? \"The member who made it disconnects it on the team's Integrations page in the app.\"\n : code === 'MCP_SERVER_FROM_TEMPLATE'\n ? 'It stays while the agent template declares it: change the template, apply and publish.'\n : code === 'PRODUCT_NOT_ENTITLED'\n ? '\"ekanos sources products\" shows what this Source has; only those can be in its scopes.'\n : code === 'TEMPLATE_ARCHIVED'\n ? 'Unarchive it first: \"ekanos agents unarchive <key>\".'\n : 'See \"ekanos teams --help\".',\n );\n }\n if (response.status === 400 && code === 'UNKNOWN_ROLE') {\n throw validationError(\n message ?? 'No such role.',\n 'Run \"ekanos teams roles list <team>\" for the roles this Source uses.',\n );\n }\n if (response.status === 400 && code === 'INVALID_FIELDS') {\n throw validationError(\n message ?? 'The host refused the fields.',\n 'Run \"ekanos teams app set <team> <product>\" again.',\n );\n }\n if (response.status === 400) {\n throw usageError(\n message ?? 'The host refused the request.',\n 'See \"ekanos teams --help\".',\n );\n }\n if (!response.ok) {\n throw networkError(\n `${host}${init.path} responded ${response.status}.`,\n response.status >= 500\n ? 'The Ekanos deployment returned a server error. Retry shortly.'\n : 'Confirm the host runs a build that includes the teams routes.',\n );\n }\n\n const parsed = schema.safeParse(body.data);\n if (!parsed.success) {\n throw networkError(\n `${host}/api/partner/teams answered in a shape this CLI does not read.`,\n 'Run \"ekanos upgrade\" — the CLI and the host disagree on the teams contract.',\n );\n }\n return { status: 'ok', data: parsed.data };\n}\n\nasync function readOptionalJson(\n response: Response,\n): Promise<Record<string, unknown>> {\n try {\n const parsed: unknown = await response.json();\n return typeof parsed === 'object' && parsed !== null\n ? (parsed as Record<string, unknown>)\n : {};\n } catch {\n return {};\n }\n}\n"]}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@ekanos/cli",
3
- "version": "0.14.0",
3
+ "version": "0.15.0",
4
4
  "private": false,
5
5
  "description": "The Ekanos partner toolchain CLI: scaffold, validate, and test an Ekanos integration against the published @ekanos packages. Agent-native — every verb speaks JSON with a stable exit-code taxonomy.",
6
6
  "keywords": [
@@ -35,7 +35,7 @@
35
35
  },
36
36
  "dependencies": {
37
37
  "@clack/prompts": "1.7.0",
38
- "@ekanos/integration-schema": "0.16.0",
38
+ "@ekanos/integration-schema": "0.17.0",
39
39
  "esbuild": "0.28.1",
40
40
  "picocolors": "1.1.1"
41
41
  },
@@ -12,12 +12,12 @@
12
12
  "prepare": "node scripts/setup-hooks.mjs"
13
13
  },
14
14
  "dependencies": {
15
- "@ekanos/sdk": "^0.16.0",
16
- "@ekanos/ui": "^0.16.0"
15
+ "@ekanos/sdk": "^0.17.0",
16
+ "@ekanos/ui": "^0.17.0"
17
17
  },
18
18
  "devDependencies": {
19
- "@ekanos/cli": "^0.14.0",
20
- "@ekanos/harness": "^0.16.0",
19
+ "@ekanos/cli": "^0.15.0",
20
+ "@ekanos/harness": "^0.17.0",
21
21
  "@hookform/resolvers": "^5.2.2",
22
22
  "@tailwindcss/postcss": "^4.3.3",
23
23
  "@tanstack/react-query": "^5.101.4",
@@ -188,23 +188,24 @@ in parentheses are the recommendation when the user has no preference.
188
188
  new draft; publishing puts the team back to following.
189
189
  4. Ask: publish this version to every team now? Only on yes:
190
190
  `npx @ekanos/cli agents publish <key> --source <slug> --to <n> --yes`.
191
- When the user is the person the agent runs as on their teams, ask once
192
- whether to add `--confirm-access` (it confirms, as them, that the agent
193
- may use their connections there, and moves those teams at once; never
194
- add it without their yes). A version that reaches further than a team
195
- confirmed does not break that team: it is **held** on the version it
196
- runs until the person it runs as confirms. The output lists each held
197
- team, what the new version adds, who confirms and the `teams agents
198
- confirm` command (which moves it) — relay it; never send them to the app
199
- for it.
191
+ The publish is the confirmation: every team that follows the agent
192
+ moves to the new version, and one that had confirmed what it may use
193
+ stays confirmed, now in the publisher's name — even when the version
194
+ reaches further. No team is held. Ask once whether to add
195
+ `--confirm-access` (it also confirms, as the user, every team on that
196
+ version that was never confirmed; never add it without their yes). The
197
+ output lists any team pinned to another version, what the new version
198
+ would add to it, and the `teams agents unpin` command that moves it —
199
+ relay it.
200
200
  5. If anything waits for approval, name its reviewers (**Reviewers**
201
201
  below) before teams turn it on — a draft nobody may decide just waits.
202
202
  6. Hand over the team-side checklist (`references/triggers.md` has the
203
203
  per-integration parts): find it under Agents → "Provided for your team",
204
204
  Turn on, connect what it needs, **install the channel's agent for a
205
- channel trigger**, confirm access (`teams agents confirm <team> <key>`,
206
- by the person it runs as, or `teams agents enable … --confirm-access`
207
- when that is the user), add triggers. Suggest one team pilots
205
+ channel trigger**, confirm access (`teams agents confirm <team> <key>`
206
+ or `teams agents enable … --confirm-access`, as the user; or a team
207
+ manager in the app — never a plain member), add triggers. Suggest one
208
+ team pilots
208
209
  it first, and do § 4 with them.
209
210
 
210
211
  ## 4. Make it reachable, and prove it end to end
@@ -31,25 +31,21 @@ Built with `ekanos agents` by a Source admin.
31
31
  - **What stays the team's:** whether it is on, its triggers, its own
32
32
  connections, its run history, and whatever `teamCustomization` lets it add.
33
33
  - **Confirming access.** The agent uses the connections of the person it
34
- runs as, and in runs no one watches only once that person confirms it may:
35
- `ekanos teams agents confirm <team> <key>`, signed in as themselves (or
36
- `teams agents enable <team> <key> --confirm-access` to turn it on as
37
- yourself and confirm at once). Nobody confirms for anyone else.
34
+ runs as, and in runs no one watches only once someone who sets it up
35
+ confirms it may: the Source admin with `ekanos teams agents confirm <team>
36
+ <key>` (or `teams agents enable <team> <key> --confirm-access` to turn it
37
+ on and confirm at once), or one of the team's agent managers with
38
+ **Confirm access** in the app. Each confirms as themselves; a plain team
39
+ member never does. It confirms only the version it printed: a newer
40
+ publish since is refused, not confirmed unseen.
38
41
  - **When a new version needs more access** than a team confirmed (a new
39
42
  product or tool, `custom` → `read_only`/`all`, a tool that now runs without
40
- approval), that team is **held**: it keeps running the version it is on,
41
- confirmed and working, and the new one waits until the person it runs as
42
- confirms it — `ekanos teams agents confirm <team> <key>`, which prints the
43
- version it confirms and moves the team to it at once (or **Confirm and
44
- update** on the agent's page); a version published after that is refused,
45
- not confirmed unseen. Nobody
46
- else can move it. Skills, instructions, model, triggers and links never
47
- hold a team. `agents publish` lists every held team, what the version adds,
48
- who confirms and the command; `agents publish --confirm-access` confirms,
49
- and moves, every team where the agent runs as the publisher. `teams agents
50
- list|show` say "held on vN, vM waiting for confirmation" — the agent is
51
- still live. A held team that gets another publish waits for the newest; a
52
- team that never confirmed simply moves; a pinned team stays on its pin.
43
+ approval), the publish is the confirmation: every following team moves to
44
+ it and stays confirmed, now in the publisher's name. No team is held.
45
+ `agents publish --confirm-access` also confirms every team on that version
46
+ that was never confirmed. A team that never confirmed moves unconfirmed; a
47
+ pinned team stays on its pin, and `agents publish` lists it with what the
48
+ new version would add and the `teams agents unpin` command.
53
49
 
54
50
  Good for: the same job done by several teams; a central owner who improves
55
51
  it over time; consistent behaviour and approvals.
@@ -57,7 +53,7 @@ it over time; consistent behaviour and approvals.
57
53
  **A Source admin can do a team's part from the terminal**:
58
54
  `ekanos teams agents enable <team> <key> [--as <member-email>]` turns it on
59
55
  for the team (running as that member, the team's owner by default; with
60
- `--confirm-access`, as you, confirmed in the same step),
56
+ `--confirm-access`, you confirm it in the same step),
61
57
  `ekanos teams agents pin|unpin`, `ekanos teams agents policy`, and
62
58
  `ekanos teams triggers|links|mcp` set up the rest. `ekanos teams agents list
63
59
  <team>` shows where each team stands and what it still needs connected.
@@ -123,9 +123,10 @@ brands, groups and organizations match by name or id. Where the answer goes
123
123
  webhook URL), for a Slack trigger the team's Slack. `teams agents list
124
124
  <team>` shows each agent's `channels`; none may be `ready: false`.
125
125
  4. Do each integration's own setup (team app, webhook) from its guide.
126
- 5. Confirm access: the person it runs as runs `npx @ekanos/cli teams agents
127
- confirm <team> <key> --source <slug>` as themselves (or turned it on with
128
- `--confirm-access`). `teams agents list <team>` shows anyone still to.
126
+ 5. Confirm access: the Source admin runs `npx @ekanos/cli teams agents
127
+ confirm <team> <key> --source <slug>` (or turned it on with
128
+ `--confirm-access`), or a team manager confirms in the app. `teams agents
129
+ list <team>` shows any agent still unconfirmed.
129
130
  6. Add the triggers above — unless the template already sets them.
130
131
  7. Prove it end to end: a real @mention (or the real event) → a run in
131
132
  `runs list --team <team>` → the agent's reply where it was asked. A test
@@ -187,21 +187,23 @@ always `ekanos teams <area> <verb> <team> …`:
187
187
  - `ekanos teams agents enable <team> <key> [--as <member-email>]
188
188
  [--confirm-access]` / `disable <team> <key>` — the app's "Turn on" /
189
189
  "Turn off". The agent runs as a team member who manages agents (the
190
- team's owner by default; with `--confirm-access`, you).
191
- - `ekanos teams agents confirm <team> <key>` — the person the agent runs as
192
- confirms, as themselves, that it may use their connections in runs no one
193
- watches; the output says which products' connections that covers. It
194
- confirms only the version it printed: a newer publish since is refused, to
195
- be reviewed and confirmed again. Nobody confirms for anyone else.
190
+ team's owner by default); `--confirm-access` also confirms it, as you.
191
+ - `ekanos teams agents confirm <team> <key>` — you confirm, as yourself,
192
+ that the agent may use its connections (the person it runs as's) in runs
193
+ no one watches; the output says which products' connections that covers.
194
+ Whoever sets an agent up confirms it — the Source admin, or a team
195
+ manager in the app — never a plain team member. It confirms only the
196
+ version it printed: a newer publish since is refused, to be reviewed and
197
+ confirmed again.
196
198
  - `ekanos teams agents pin <team> <key> <version>` / `unpin <team> <key>`.
197
199
  - `ekanos teams agents policy <team> <key>` — every tool the agent can call,
198
200
  read or write, and whether it runs on its own or waits for approval;
199
201
  `… policy <team> <key> set <tool> auto|approve`, `unset <tool>`,
200
202
  `--reads auto|approve --writes auto|approve`. A provided agent's policy
201
203
  follows its template unless the template turns on team overrides for it.
202
- On any agent, a change that lets more run on its own drops the confirmation
203
- of the person it runs as, and the agent waits for them to confirm again
204
- (`--confirm-access` when that person is you).
204
+ On any agent, a change that lets more run on its own drops the
205
+ confirmation, and the agent uses only what needs none until someone who
206
+ sets it up confirms again (`--confirm-access` does it in the same step).
205
207
  - `ekanos teams agents skills <team> <key> [add|remove <skill>]` — the
206
208
  skills the agent reads; attach a team skill (pushed with
207
209
  `skills push --team`) or a Source one. A provided agent takes them only
@@ -276,4 +278,4 @@ is refused (`USER_NOT_IN_SOURCE`): `ekanos teams list` shows the teams.
276
278
  | Which products a team sees in the app (product scopes) | A Source admin: `ekanos sources scopes` (and `add`/`remove <scope> <product>`), `ekanos teams scope show\|set <team>`; creating a scope is in /admin |
277
279
  | Is a team's agent live, and if not, what is the next step | A Source admin, with `ekanos teams agents show <team> <key>`; the whole team on one screen with `ekanos teams show <team>` |
278
280
  | Disconnecting a team's integration, removing a team's MCP server | A Source admin, with `ekanos teams disconnect <team> <product> --yes` / `ekanos teams mcp remove <team> <server-key> --yes`, or the team in the app |
279
- | Confirming an agent may use a person's connections | Only the person it runs as, signed in as themselves: `ekanos teams agents confirm <team> <key>` (or `enable --confirm-access`, `agents publish --confirm-access`), or **Confirm access** in the app. On a team held on an earlier version (a newer one reaches further than they confirmed) it moves the team to the version waiting |
281
+ | Confirming an agent may use its connections | Whoever sets it up, as themselves: the Source admin with `ekanos teams agents confirm <team> <key>` (or `enable --confirm-access`, `agents publish --confirm-access`), or a team manager with **Confirm access** in the app — never a plain member. A publish is the confirmation for following teams: no team is held on an earlier version |