Skip to content

Commit e0abb77

Browse files
committed
chore: merge main, resolve conflicts on built-in-agent slug
2 parents 92a7d78 + 64ac609 commit e0abb77

2,518 files changed

Lines changed: 210989 additions & 16130 deletions

File tree

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.
Lines changed: 172 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,172 @@
1+
# Daily audit for GHCR container packages that are unlinked from a source
2+
# repository (`repository: null` on the GHCR API).
3+
#
4+
# WHY THIS EXISTS
5+
# ---------------
6+
# When a GHCR container package is not linked to a repository, workflow
7+
# builds in `CopilotKit/CopilotKit` get `403 Forbidden` on push to GHCR —
8+
# the workflow's `GITHUB_TOKEN` only has package-write permissions when
9+
# the package is linked to the actor's repo. We hit this twice in quick
10+
# succession (`showcase-ops` caught manually after a failed deploy, and
11+
# `showcase-pocketbase` caught by a preemptive scan). There is NO GitHub
12+
# API to programmatically link a package to a repo — it is UI-only — so
13+
# the only way to prevent future surprises is detect drift early via a
14+
# scheduled audit + Slack alert.
15+
#
16+
# This workflow is the operationalization of the lesson captured in
17+
# `feedback_ghcr_new_package_403.md`.
18+
#
19+
# REQUIRED SECRETS
20+
# ----------------
21+
# - ORG_READ_PACKAGES_PAT: a fine-grained PAT with `read:packages` scope,
22+
# org-scoped to `CopilotKit`. The default `secrets.GITHUB_TOKEN` does
23+
# NOT have `read:packages` for the org and cannot list org packages.
24+
# - SLACK_WEBHOOK_GHCR_DRIFT: a CopilotKit-internal Slack incoming-webhook
25+
# URL. Posts to whichever channel the webhook is bound to (intended:
26+
# an internal alerts channel).
27+
#
28+
# If `ORG_READ_PACKAGES_PAT` is unset the workflow fails loudly — drift
29+
# detection silently disabled is worse than no workflow at all.
30+
# If `SLACK_WEBHOOK_GHCR_DRIFT` is unset the workflow logs a warning
31+
# (the audit still runs) so a missing webhook does not mask drift.
32+
#
33+
# EXIT CODES
34+
# ----------
35+
# This workflow exits 0 in all non-error cases (including when drift is
36+
# present). The Slack message IS the alert; failing the workflow on
37+
# drift would create noisy red CI checks on a schedule.
38+
39+
name: GHCR unlinked-package audit
40+
41+
on:
42+
schedule:
43+
# Daily at 14:00 UTC (07:00 PT / 10:00 ET) — low-traffic window,
44+
# well before the US workday's deploy activity.
45+
- cron: "0 14 * * *"
46+
workflow_dispatch: {}
47+
48+
permissions:
49+
contents: read
50+
51+
jobs:
52+
audit:
53+
name: Audit org container packages for unlinked repos
54+
# Hoist the Slack webhook into an env var so step-level `if:`
55+
# expressions can reference it — `secrets.*` is not a valid
56+
# named-value inside `if:` and causes a workflow startup failure.
57+
env:
58+
SLACK_WEBHOOK: ${{ secrets.SLACK_WEBHOOK_GHCR_DRIFT }}
59+
runs-on: ubuntu-latest
60+
timeout-minutes: 5
61+
steps:
62+
- name: Verify ORG_READ_PACKAGES_PAT is set
63+
env:
64+
PAT: ${{ secrets.ORG_READ_PACKAGES_PAT }}
65+
run: |
66+
if [ -z "$PAT" ]; then
67+
echo "::error::ORG_READ_PACKAGES_PAT is not set. This workflow requires a fine-grained PAT with read:packages scope, org-scoped to CopilotKit. See the workflow header comment in .github/workflows/ghcr_unlinked_packages.yml for setup."
68+
exit 1
69+
fi
70+
echo "ORG_READ_PACKAGES_PAT present."
71+
72+
- name: List org container packages and identify unlinked
73+
id: audit
74+
env:
75+
GH_TOKEN: ${{ secrets.ORG_READ_PACKAGES_PAT }}
76+
run: |
77+
set -euo pipefail
78+
79+
# Page through all container packages in the CopilotKit org.
80+
# `--paginate` follows Link headers; per_page=100 minimizes
81+
# request count. `gh api` returns one JSON array per page;
82+
# `--slurp` is unnecessary because gh concatenates pages into
83+
# a single stream when called with `--paginate` on an array
84+
# endpoint.
85+
all_packages_json="$(gh api \
86+
--paginate \
87+
-H "Accept: application/vnd.github+json" \
88+
"/orgs/CopilotKit/packages?package_type=container&per_page=100")"
89+
90+
total="$(echo "$all_packages_json" | jq 'length')"
91+
echo "Total container packages in CopilotKit org: $total"
92+
93+
# Filter for packages where repository is null. Emit a compact
94+
# JSON array of {name, visibility} objects for downstream use.
95+
unlinked_json="$(echo "$all_packages_json" \
96+
| jq -c '[.[] | select(.repository == null) | {name: .name, visibility: .visibility}]')"
97+
98+
unlinked_count="$(echo "$unlinked_json" | jq 'length')"
99+
echo "Unlinked container packages: $unlinked_count"
100+
101+
# Emit outputs for the next step. Use the multiline-output
102+
# delimiter form for the JSON array so jq output with embedded
103+
# special chars survives intact.
104+
{
105+
echo "unlinked_count=$unlinked_count"
106+
echo "unlinked_json<<EOF"
107+
echo "$unlinked_json"
108+
echo "EOF"
109+
} >> "$GITHUB_OUTPUT"
110+
111+
if [ "$unlinked_count" = "0" ]; then
112+
echo "::notice::No GHCR drift — all CopilotKit org container packages are linked to a repository."
113+
else
114+
echo "::warning::Detected $unlinked_count unlinked container package(s):"
115+
echo "$unlinked_json" | jq -r '.[] | " - \(.name) (\(.visibility))"'
116+
fi
117+
118+
- name: Build Slack payload
119+
id: payload
120+
if: steps.audit.outputs.unlinked_count != '0'
121+
env:
122+
UNLINKED_JSON: ${{ steps.audit.outputs.unlinked_json }}
123+
UNLINKED_COUNT: ${{ steps.audit.outputs.unlinked_count }}
124+
RUN_URL: https://github.com/${{ github.repository }}/actions/runs/${{ github.run_id }}
125+
run: |
126+
set -euo pipefail
127+
128+
# Build a single `text` field with mrkdwn — keeps the payload
129+
# compatible with both incoming-webhooks and channel webhooks.
130+
# Each unlinked package gets a deep link to its Actions-access
131+
# settings page, where the UI fix lives.
132+
lines="$(echo "$UNLINKED_JSON" | jq -r '.[] | "• <https://github.com/orgs/CopilotKit/packages/container/\(.name)/settings|\(.name)> (\(.visibility))"')"
133+
134+
# Build message via printf — avoids heredoc indentation
135+
# gotchas (closing delimiter must be column-0, which confuses
136+
# YAML linters on `run: |` blocks). mrkdwn renders *bold*,
137+
# _italic_, and <url|label> links.
138+
nl=$'\n'
139+
message=":warning: *GHCR drift detected* — ${UNLINKED_COUNT} container package(s) in the \`CopilotKit\` org are unlinked from a source repository.${nl}${nl}"
140+
message="${message}${lines}${nl}${nl}"
141+
message="${message}*UI fix (per package):* open the settings link above → *Manage Actions access* → *Add Repository* → \`CopilotKit/CopilotKit\` → *Write*.${nl}${nl}"
142+
message="${message}_This drift breaks future workflow builds with \`403 Forbidden\` on push to GHCR. <${RUN_URL}|View audit run>_"
143+
144+
# Emit as a multiline output so the next step can consume it
145+
# without re-quoting through a shell.
146+
{
147+
echo "text<<EOF"
148+
echo "$message"
149+
echo "EOF"
150+
} >> "$GITHUB_OUTPUT"
151+
152+
- name: Notify Slack (drift detected)
153+
if: steps.audit.outputs.unlinked_count != '0' && env.SLACK_WEBHOOK != ''
154+
uses: slackapi/slack-github-action@v2.1.0
155+
with:
156+
webhook: ${{ secrets.SLACK_WEBHOOK_GHCR_DRIFT }}
157+
webhook-type: incoming-webhook
158+
# Wrap the dynamic message via toJSON so quotes/newlines/
159+
# backslashes inside package names or visibility values are
160+
# safely JSON-encoded instead of breaking the payload.
161+
payload: |
162+
{ "text": ${{ toJSON(steps.payload.outputs.text) }} }
163+
164+
- name: Log (no Slack — webhook unset)
165+
if: steps.audit.outputs.unlinked_count != '0' && env.SLACK_WEBHOOK == ''
166+
run: |
167+
echo "::warning::Drift detected but SLACK_WEBHOOK_GHCR_DRIFT is not set; no Slack notification sent. See run logs above for the unlinked package list."
168+
169+
- name: Log (no drift)
170+
if: steps.audit.outputs.unlinked_count == '0'
171+
run: |
172+
echo "No drift — exiting 0."

.github/workflows/showcase_deploy.yml

Lines changed: 14 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -53,6 +53,7 @@ on:
5353
- shell-dojo
5454
- shell-dashboard
5555
- shell-docs
56+
- showcase-ops
5657

5758
concurrency:
5859
# Key on `event_name + ref` so push events and manual workflow_dispatch
@@ -179,6 +180,11 @@ jobs:
179180
- 'showcase/shared/**'
180181
- 'showcase/scripts/**'
181182
- 'showcase/packages/*/manifest.yaml'
183+
showcase_ops:
184+
- 'showcase/ops/**'
185+
- 'showcase/shared/**'
186+
- 'showcase/scripts/**'
187+
- 'showcase/packages/*/manifest.yaml'
182188
183189
- name: Build service matrix
184190
id: build-matrix
@@ -228,8 +234,9 @@ jobs:
228234
{"dispatch_name":"starter-spring-ai","filter_key":"starter_spring_ai","context":"showcase/starters/spring-ai","image":"showcase-starter-spring-ai","railway_id":"3559ece3-7ba3-41ac-b24c-1f780133ec58","timeout":15,"lfs":false,"build_args":"","dockerfile":"","health_path":"/api/health"},
229235
{"dispatch_name":"starter-strands","filter_key":"starter_strands","context":"showcase/starters/strands","image":"showcase-starter-strands","railway_id":"06db2bb8-e15d-4c6a-97ad-e14777c92d9f","timeout":15,"lfs":false,"build_args":"","dockerfile":"","health_path":"/api/health"},
230236
{"dispatch_name":"shell-dojo","filter_key":"shell_dojo","context":".","image":"showcase-shell-dojo","railway_id":"7ad1ece7-2228-49cd-8a78-bddf30322907","timeout":10,"lfs":false,"build_args":"","dockerfile":"showcase/shell-dojo/Dockerfile","health_path":"/"},
231-
{"dispatch_name":"shell-dashboard","filter_key":"shell_dashboard","context":".","image":"showcase-shell-dashboard","railway_id":"4d5dfd74-be61-40b2-8564-b53b7dd4c15b","timeout":10,"lfs":true,"build_args_sha":"${{ github.sha }}","build_args_branch":"${{ github.ref_name }}","build_args_pb_url":"https://showcase-pocketbase-production.up.railway.app","build_args_shell_url":"https://showcase.copilotkit.ai","dockerfile":"showcase/shell-dashboard/Dockerfile","health_path":"/"},
232-
{"dispatch_name":"shell-docs","filter_key":"shell_docs","context":".","image":"showcase-shell-docs","railway_id":"7badfb8d-4228-414c-9145-b4026803714f","timeout":10,"lfs":true,"build_args_sha":"${{ github.sha }}","build_args_branch":"${{ github.ref_name }}","dockerfile":"showcase/shell-docs/Dockerfile","health_path":"/"}
237+
{"dispatch_name":"shell-dashboard","filter_key":"shell_dashboard","context":".","image":"showcase-shell-dashboard","railway_id":"4d5dfd74-be61-40b2-8564-b53b7dd4c15b","timeout":10,"lfs":true,"build_args_sha":"${{ github.sha }}","build_args_branch":"${{ github.ref_name }}","build_args_pb_url":"https://showcase-pocketbase-production.up.railway.app","build_args_shell_url":"https://showcase.copilotkit.ai","build_args_ops_url":"https://showcase-ops-production.up.railway.app","dockerfile":"showcase/shell-dashboard/Dockerfile","health_path":"/"},
238+
{"dispatch_name":"shell-docs","filter_key":"shell_docs","context":".","image":"showcase-shell-docs","railway_id":"7badfb8d-4228-414c-9145-b4026803714f","timeout":10,"lfs":true,"build_args_sha":"${{ github.sha }}","build_args_branch":"${{ github.ref_name }}","dockerfile":"showcase/shell-docs/Dockerfile","health_path":"/"},
239+
{"dispatch_name":"showcase-ops","filter_key":"showcase_ops","context":".","image":"showcase-ops","railway_id":"3a14bfed-0537-4d71-897b-7c593dca161d","timeout":20,"lfs":false,"build_args":"","dockerfile":"showcase/ops/Dockerfile","health_path":"/health"}
233240
]'
234241
235242
DISPATCH="${{ github.event.inputs.service }}"
@@ -349,6 +356,11 @@ jobs:
349356
if [ -n "${{ matrix.service.build_args_shell_url }}" ]; then
350357
ARGS="${ARGS:+${ARGS}$'\n'}NEXT_PUBLIC_SHELL_URL=${{ matrix.service.build_args_shell_url }}"
351358
fi
359+
if [ -n "${{ matrix.service.build_args_ops_url }}" ]; then
360+
# OPS_BASE_URL is required at build time by shell-dashboard's
361+
# next.config.ts rewrites() — without it `next build` aborts.
362+
ARGS="${ARGS:+${ARGS}$'\n'}OPS_BASE_URL=${{ matrix.service.build_args_ops_url }}"
363+
fi
352364
# Use delimiter to safely pass multiline value
353365
echo "args<<BUILDARGS_EOF" >> $GITHUB_OUTPUT
354366
echo "$ARGS" >> $GITHUB_OUTPUT

.github/workflows/showcase_validate.yml

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -119,8 +119,15 @@ jobs:
119119
found=0
120120
for pkg_dir in showcase/packages/*/; do
121121
[ -d "$pkg_dir" ] || continue
122-
found=$((found + 1))
123122
pkg=$(basename "$pkg_dir")
123+
# Skip manifest-only packages (no src/ directory) — these are
124+
# virtual/meta integrations (e.g. built-in-agent) that carry no
125+
# source code or demos and therefore have no e2e specs to enforce.
126+
if [ ! -d "${pkg_dir}src" ]; then
127+
echo "skip: $pkg (manifest-only, no src/)"
128+
continue
129+
fi
130+
found=$((found + 1))
124131
e2e_dir="${pkg_dir}tests/e2e/"
125132
if [ ! -d "$e2e_dir" ]; then
126133
echo "::error file=$pkg_dir::Package '$pkg' is missing tests/e2e/ directory (required for baseline e2e coverage)"

.github/workflows/static_quality.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -74,7 +74,7 @@ jobs:
7474
git diff --name-only --diff-filter=ACMR "origin/$base_ref"...HEAD -- \
7575
'*.js' '*.jsx' '*.ts' '*.tsx' '*.mjs' '*.cjs' \
7676
'*.json' '*.jsonc' '*.json5' \
77-
'*.md' '*.mdx' \
77+
'*.md' \
7878
'*.css' '*.yml' '*.yaml' '*.html' '*.vue' \
7979
> .pr-format-files.txt
8080
: > .pr-format-files.existing.txt

docs/content/docs/integrations/langgraph/agent-app-context.mdx

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -84,17 +84,17 @@ This context can then be shared with your LangChain agent.
8484
<Tab value="TypeScript">
8585
```typescript title="agent-js/src/agent.ts"
8686
// ...
87-
import { Annotation } from "@langchain/langgraph";
88-
import { CopilotKitStateAnnotation } from "@copilotkit/sdk-js/langgraph";
87+
import { StateSchema } from "@langchain/langgraph";
88+
import { CopilotKitStateSchema } from "@copilotkit/sdk-js/langgraph";
8989
// ...
9090

9191
// This is the state of the agent.
9292
// It inherits from the CopilotKitState properties from CopilotKit.
93-
export const AgentStateAnnotation = Annotation.Root({
93+
export const AgentStateSchema = new StateSchema({
9494
// ... Your defined state properties
95-
...CopilotKitStateAnnotation.spec,
95+
...CopilotKitStateSchema.fields,
9696
});
97-
export type AgentState = typeof AgentStateAnnotation.State;
97+
export type AgentState = typeof AgentStateSchema.State;
9898
```
9999
</Tab>
100100
</Tabs>
@@ -148,11 +148,11 @@ This context can then be shared with your LangChain agent.
148148
import { ChatOpenAI } from "@langchain/openai";
149149

150150
// add the agent state definition from the previous step
151-
export const AgentStateAnnotation = Annotation.Root({
151+
export const AgentStateSchema = new StateSchema({
152152
// ... Your defined state properties
153-
...CopilotKitStateAnnotation.spec,
153+
...CopilotKitStateSchema.fields,
154154
});
155-
export type AgentState = typeof AgentStateAnnotation.State;
155+
export type AgentState = typeof AgentStateSchema.State;
156156

157157
async function chat_node(state: AgentState, config: RunnableConfig) {
158158
// Extract the colleagues from CopilotKit context

docs/content/docs/integrations/langgraph/configurable.mdx

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -107,17 +107,18 @@ Now you can simply pull the values from the provided config argument in any agen
107107
</Tab>
108108
<Tab value="TypeScript">
109109
```typescript
110-
import { Annotation } from "@langchain/langgraph";
110+
import { StateSchema } from "@langchain/langgraph";
111+
import { z } from "zod";
111112

112113
// define which properties will be allowed in the configuration
113-
export const ConfigSchemaAnnotation = Annotation.Root({
114-
authToken: Annotation<string>
114+
export const ConfigSchema = new StateSchema({
115+
authToken: z.string()
115116
})
116117

117118
// ...add all necessary graph nodes
118119

119120
// when defining the state graph, apply the config schema
120-
const workflow = new StateGraph(AgentStateAnnotation, ConfigSchemaAnnotation)
121+
const workflow = new StateGraph(AgentStateSchema, ConfigSchema)
121122
```
122123
</Tab>
123124
</Tabs>

docs/content/docs/integrations/langgraph/frontend-tools.mdx

Lines changed: 7 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -96,14 +96,15 @@ Use frontend tools when you need your agent to interact with client-side primiti
9696
</Tab>
9797
<Tab value="TypeScript">
9898
```typescript title="agent-js/src/agent.ts"
99-
import { Annotation } from "@langchain/langgraph";
100-
import { CopilotKitStateAnnotation } from "@copilotkit/sdk-js/langgraph"; // [!code highlight]
99+
import { StateSchema } from "@langchain/langgraph";
100+
import { CopilotKitStateSchema } from "@copilotkit/sdk-js/langgraph"; // [!code highlight]
101+
import { z } from "zod";
101102

102-
export const YourAgentStateAnnotation = Annotation.Root({
103-
yourAdditionalProperty: Annotation<string>,
104-
...CopilotKitStateAnnotation.spec, // [!code highlight]
103+
export const YourAgentStateSchema = new StateSchema({
104+
yourAdditionalProperty: z.string(),
105+
...CopilotKitStateSchema.fields, // [!code highlight]
105106
});
106-
export type YourAgentState = typeof YourAgentStateAnnotation.State;
107+
export type YourAgentState = typeof YourAgentStateSchema.State;
107108
```
108109
</Tab>
109110
</Tabs>

docs/content/docs/integrations/langgraph/generative-ui/state-rendering.mdx

Lines changed: 7 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -51,14 +51,15 @@ Use state rendering when you want to:
5151
</Tab>
5252
<Tab value="TypeScript">
5353
```typescript title="agent-js/src/agent.ts"
54-
import { Annotation } from "@langchain/langgraph";
55-
import { CopilotKitStateAnnotation } from "@copilotkit/sdk-js/langgraph";
54+
import { StateSchema } from "@langchain/langgraph";
55+
import { CopilotKitStateSchema } from "@copilotkit/sdk-js/langgraph";
56+
import { z } from "zod";
5657

57-
export const AgentStateAnnotation = Annotation.Root({
58-
searches: Annotation<{ query: string; done: boolean }[]>,
59-
...CopilotKitStateAnnotation.spec,
58+
export const AgentStateSchema = new StateSchema({
59+
searches: z.array(z.object({ query: z.string(), done: z.boolean() })).default(() => []),
60+
...CopilotKitStateSchema.fields,
6061
});
61-
export type AgentState = typeof AgentStateAnnotation.State;
62+
export type AgentState = typeof AgentStateSchema.State;
6263
```
6364
</Tab>
6465
</Tabs>

docs/content/docs/integrations/langgraph/generative-ui/your-components/display-only.mdx

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -92,13 +92,13 @@ For components that need user interaction, see [Interactive](/langgraph/generati
9292
</Tab>
9393
<Tab value="TypeScript">
9494
```typescript title="agent-js/src/agent.ts"
95-
import { Annotation } from "@langchain/langgraph";
96-
import { CopilotKitStateAnnotation } from "@copilotkit/sdk-js/langgraph"; // [!code highlight]
95+
import { StateSchema } from "@langchain/langgraph";
96+
import { CopilotKitStateSchema } from "@copilotkit/sdk-js/langgraph"; // [!code highlight]
9797

98-
export const AgentStateAnnotation = Annotation.Root({
99-
...CopilotKitStateAnnotation.spec, // [!code highlight]
98+
export const AgentStateSchema = new StateSchema({
99+
...CopilotKitStateSchema.fields, // [!code highlight]
100100
});
101-
export type AgentState = typeof AgentStateAnnotation.State;
101+
export type AgentState = typeof AgentStateSchema.State;
102102
```
103103
</Tab>
104104
</Tabs>

0 commit comments

Comments
 (0)