@agent-native/core 0.107.1 → 0.108.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/corpus/README.md +2 -2
- package/corpus/core/CHANGELOG.md +12 -0
- package/corpus/core/docs/content/actions.mdx +48 -0
- package/corpus/core/docs/content/locales/ar-SA/actions.mdx +38 -0
- package/corpus/core/docs/content/locales/de-DE/actions.mdx +38 -0
- package/corpus/core/docs/content/locales/es-ES/actions.mdx +38 -0
- package/corpus/core/docs/content/locales/fr-FR/actions.mdx +38 -0
- package/corpus/core/docs/content/locales/hi-IN/actions.mdx +38 -0
- package/corpus/core/docs/content/locales/ja-JP/actions.mdx +38 -0
- package/corpus/core/docs/content/locales/ko-KR/actions.mdx +38 -0
- package/corpus/core/docs/content/locales/pt-BR/actions.mdx +38 -0
- package/corpus/core/docs/content/locales/zh-CN/actions.mdx +38 -0
- package/corpus/core/docs/content/locales/zh-TW/actions.mdx +38 -0
- package/corpus/core/package.json +5 -1
- package/corpus/core/src/a2a/artifact-response.ts +32 -10
- package/corpus/core/src/a2a-claims.ts +52 -0
- package/corpus/core/src/action.ts +6 -2
- package/corpus/core/src/audit/record.ts +6 -0
- package/corpus/core/src/client/feature-flags/FeatureFlagsPanel.tsx +519 -0
- package/corpus/core/src/client/feature-flags/helpers.ts +77 -0
- package/corpus/core/src/client/feature-flags/index.ts +13 -0
- package/corpus/core/src/client/feature-flags/types.ts +29 -0
- package/corpus/core/src/client/feature-flags/use-feature-flag.ts +26 -0
- package/corpus/core/src/client/index.ts +11 -0
- package/corpus/core/src/extensions/routes.ts +1 -1
- package/corpus/core/src/feature-flags/a2a-action-route.ts +56 -0
- package/corpus/core/src/feature-flags/actions/get-feature-flags.ts +24 -0
- package/corpus/core/src/feature-flags/actions/list-feature-flags.ts +69 -0
- package/corpus/core/src/feature-flags/actions/set-feature-flag.ts +89 -0
- package/corpus/core/src/feature-flags/index.ts +21 -0
- package/corpus/core/src/feature-flags/permissions.ts +53 -0
- package/corpus/core/src/feature-flags/plugin.ts +44 -0
- package/corpus/core/src/feature-flags/registry.ts +96 -0
- package/corpus/core/src/feature-flags/store.ts +176 -0
- package/corpus/core/src/index.ts +15 -0
- package/corpus/core/src/integrations/a2a-continuation-processor.ts +107 -3
- package/corpus/core/src/integrations/pending-tasks-store.ts +98 -1
- package/corpus/core/src/integrations/plugin.ts +129 -4
- package/corpus/core/src/integrations/webhook-handler.ts +339 -36
- package/corpus/core/src/localization/default-messages.ts +47 -0
- package/corpus/core/src/server/action-discovery.ts +12 -0
- package/corpus/core/src/server/action-routes.ts +47 -5
- package/corpus/core/src/server/agent-chat-plugin.ts +93 -8
- package/corpus/core/src/server/index.ts +1 -0
- package/corpus/core/src/settings/org-settings.ts +13 -0
- package/corpus/core/src/settings/store.ts +57 -0
- package/corpus/core/src/templates/default/.agents/skills/feature-flags/SKILL.md +169 -0
- package/corpus/core/src/templates/default/AGENTS.md +1 -0
- package/corpus/core/src/templates/headless/.agents/skills/feature-flags/SKILL.md +169 -0
- package/corpus/core/src/templates/workspace-core/.agents/skills/feature-flags/SKILL.md +169 -0
- package/corpus/core/src/templates/workspace-core/AGENTS.md +1 -1
- package/corpus/core/src/templates/workspace-root/AGENTS.md +1 -1
- package/corpus/core/src/vite/action-types-plugin.ts +12 -0
- package/corpus/templates/analytics/.agents/skills/feature-flags/SKILL.md +169 -0
- package/corpus/templates/analytics/AGENTS.md +15 -3
- package/corpus/templates/analytics/actions/list-workspace-feature-flags.ts +15 -0
- package/corpus/templates/analytics/actions/navigate.ts +2 -2
- package/corpus/templates/analytics/actions/set-workspace-feature-flag.ts +45 -0
- package/corpus/templates/analytics/actions/view-screen.ts +13 -0
- package/corpus/templates/analytics/app/components/agents/FeatureFlagsFleetPanel.tsx +243 -0
- package/corpus/templates/analytics/app/components/layout/CommandPalette.tsx +11 -3
- package/corpus/templates/analytics/app/hooks/use-navigation-state.ts +3 -1
- package/corpus/templates/analytics/app/i18n/zh-TW.ts +17 -0
- package/corpus/templates/analytics/app/i18n-data.ts +251 -0
- package/corpus/templates/analytics/app/pages/Agents.tsx +22 -2
- package/corpus/templates/analytics/changelog/2026-07-17-manage-feature-flag-rollouts-across-your-organization-s-apps.md +6 -0
- package/corpus/templates/analytics/server/lib/db-admin-connections.ts +13 -5
- package/corpus/templates/analytics/server/lib/workspace-feature-flags.ts +347 -0
- package/corpus/templates/assets/.agents/skills/feature-flags/SKILL.md +169 -0
- package/corpus/templates/brain/.agents/skills/feature-flags/SKILL.md +169 -0
- package/corpus/templates/calendar/.agents/skills/feature-flags/SKILL.md +169 -0
- package/corpus/templates/chat/.agents/skills/feature-flags/SKILL.md +169 -0
- package/corpus/templates/clips/.agents/skills/feature-flags/SKILL.md +169 -0
- package/corpus/templates/clips/server/plugins/feature-flags.ts +11 -0
- package/corpus/templates/clips/shared/feature-flags.ts +30 -37
- package/corpus/templates/content/.agents/skills/feature-flags/SKILL.md +169 -0
- package/corpus/templates/design/.agents/skills/feature-flags/SKILL.md +169 -0
- package/corpus/templates/design/AGENTS.md +5 -3
- package/corpus/templates/design/actions/add-fusion-screens.ts +4 -6
- package/corpus/templates/design/actions/apply-fusion-edits.ts +4 -6
- package/corpus/templates/design/actions/create-fusion-app.ts +5 -4
- package/corpus/templates/design/actions/deploy-fusion-app.ts +4 -3
- package/corpus/templates/design/actions/get-fusion-deploy-status.ts +4 -6
- package/corpus/templates/design/actions/list-fusion-edits.ts +4 -3
- package/corpus/templates/design/actions/push-fusion-app.ts +4 -6
- package/corpus/templates/design/actions/queue-fusion-edit.ts +4 -3
- package/corpus/templates/design/actions/send-fusion-message.ts +4 -6
- package/corpus/templates/design/actions/sync-fusion-app.ts +4 -3
- package/corpus/templates/design/app/components/editor/PromptDialog.tsx +1 -1
- package/corpus/templates/design/app/pages/Index.tsx +8 -6
- package/corpus/templates/design/server/plugins/feature-flags.ts +5 -0
- package/corpus/templates/design/shared/full-app.ts +10 -7
- package/corpus/templates/dispatch/.agents/skills/feature-flags/SKILL.md +169 -0
- package/corpus/templates/forms/.agents/skills/feature-flags/SKILL.md +169 -0
- package/corpus/templates/macros/.agents/skills/feature-flags/SKILL.md +169 -0
- package/corpus/templates/mail/.agents/skills/feature-flags/SKILL.md +169 -0
- package/corpus/templates/plan/.agents/skills/feature-flags/SKILL.md +169 -0
- package/corpus/templates/slides/.agents/skills/feature-flags/SKILL.md +169 -0
- package/corpus/templates/tasks/.agents/skills/feature-flags/SKILL.md +169 -0
- package/dist/a2a/artifact-response.d.ts +5 -1
- package/dist/a2a/artifact-response.d.ts.map +1 -1
- package/dist/a2a/artifact-response.js +18 -12
- package/dist/a2a/artifact-response.js.map +1 -1
- package/dist/a2a-claims.d.ts +10 -0
- package/dist/a2a-claims.d.ts.map +1 -0
- package/dist/a2a-claims.js +41 -0
- package/dist/a2a-claims.js.map +1 -0
- package/dist/action.d.ts +6 -2
- package/dist/action.d.ts.map +1 -1
- package/dist/action.js.map +1 -1
- package/dist/audit/record.d.ts +3 -0
- package/dist/audit/record.d.ts.map +1 -1
- package/dist/audit/record.js +3 -0
- package/dist/audit/record.js.map +1 -1
- package/dist/client/feature-flags/FeatureFlagsPanel.d.ts +10 -0
- package/dist/client/feature-flags/FeatureFlagsPanel.d.ts.map +1 -0
- package/dist/client/feature-flags/FeatureFlagsPanel.js +143 -0
- package/dist/client/feature-flags/FeatureFlagsPanel.js.map +1 -0
- package/dist/client/feature-flags/helpers.d.ts +16 -0
- package/dist/client/feature-flags/helpers.d.ts.map +1 -0
- package/dist/client/feature-flags/helpers.js +50 -0
- package/dist/client/feature-flags/helpers.js.map +1 -0
- package/dist/client/feature-flags/index.d.ts +5 -0
- package/dist/client/feature-flags/index.d.ts.map +1 -0
- package/dist/client/feature-flags/index.js +4 -0
- package/dist/client/feature-flags/index.js.map +1 -0
- package/dist/client/feature-flags/types.d.ts +27 -0
- package/dist/client/feature-flags/types.d.ts.map +1 -0
- package/dist/client/feature-flags/types.js +2 -0
- package/dist/client/feature-flags/types.js.map +1 -0
- package/dist/client/feature-flags/use-feature-flag.d.ts +8 -0
- package/dist/client/feature-flags/use-feature-flag.d.ts.map +1 -0
- package/dist/client/feature-flags/use-feature-flag.js +15 -0
- package/dist/client/feature-flags/use-feature-flag.js.map +1 -0
- package/dist/client/index.d.ts +1 -0
- package/dist/client/index.d.ts.map +1 -1
- package/dist/client/index.js +1 -0
- package/dist/client/index.js.map +1 -1
- package/dist/collab/routes.d.ts +1 -1
- package/dist/collab/struct-routes.d.ts +1 -1
- package/dist/extensions/routes.d.ts.map +1 -1
- package/dist/extensions/routes.js +1 -1
- package/dist/extensions/routes.js.map +1 -1
- package/dist/feature-flags/a2a-action-route.d.ts +14 -0
- package/dist/feature-flags/a2a-action-route.d.ts.map +1 -0
- package/dist/feature-flags/a2a-action-route.js +50 -0
- package/dist/feature-flags/a2a-action-route.js.map +1 -0
- package/dist/feature-flags/actions/get-feature-flags.d.ts +3 -0
- package/dist/feature-flags/actions/get-feature-flags.d.ts.map +1 -0
- package/dist/feature-flags/actions/get-feature-flags.js +18 -0
- package/dist/feature-flags/actions/get-feature-flags.js.map +1 -0
- package/dist/feature-flags/actions/list-feature-flags.d.ts +28 -0
- package/dist/feature-flags/actions/list-feature-flags.d.ts.map +1 -0
- package/dist/feature-flags/actions/list-feature-flags.js +60 -0
- package/dist/feature-flags/actions/list-feature-flags.js.map +1 -0
- package/dist/feature-flags/actions/set-feature-flag.d.ts +26 -0
- package/dist/feature-flags/actions/set-feature-flag.d.ts.map +1 -0
- package/dist/feature-flags/actions/set-feature-flag.js +78 -0
- package/dist/feature-flags/actions/set-feature-flag.js.map +1 -0
- package/dist/feature-flags/index.d.ts +5 -0
- package/dist/feature-flags/index.d.ts.map +1 -0
- package/dist/feature-flags/index.js +5 -0
- package/dist/feature-flags/index.js.map +1 -0
- package/dist/feature-flags/permissions.d.ts +13 -0
- package/dist/feature-flags/permissions.d.ts.map +1 -0
- package/dist/feature-flags/permissions.js +37 -0
- package/dist/feature-flags/permissions.js.map +1 -0
- package/dist/feature-flags/plugin.d.ts +17 -0
- package/dist/feature-flags/plugin.d.ts.map +1 -0
- package/dist/feature-flags/plugin.js +29 -0
- package/dist/feature-flags/plugin.js.map +1 -0
- package/dist/feature-flags/registry.d.ts +23 -0
- package/dist/feature-flags/registry.d.ts.map +1 -0
- package/dist/feature-flags/registry.js +59 -0
- package/dist/feature-flags/registry.js.map +1 -0
- package/dist/feature-flags/store.d.ts +31 -0
- package/dist/feature-flags/store.d.ts.map +1 -0
- package/dist/feature-flags/store.js +124 -0
- package/dist/feature-flags/store.js.map +1 -0
- package/dist/index.d.ts +1 -0
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +1 -0
- package/dist/index.js.map +1 -1
- package/dist/integrations/a2a-continuation-processor.js +62 -5
- package/dist/integrations/a2a-continuation-processor.js.map +1 -1
- package/dist/integrations/pending-tasks-store.d.ts +3 -0
- package/dist/integrations/pending-tasks-store.d.ts.map +1 -1
- package/dist/integrations/pending-tasks-store.js +75 -1
- package/dist/integrations/pending-tasks-store.js.map +1 -1
- package/dist/integrations/plugin.d.ts.map +1 -1
- package/dist/integrations/plugin.js +81 -5
- package/dist/integrations/plugin.js.map +1 -1
- package/dist/integrations/webhook-handler.d.ts +23 -2
- package/dist/integrations/webhook-handler.d.ts.map +1 -1
- package/dist/integrations/webhook-handler.js +257 -35
- package/dist/integrations/webhook-handler.js.map +1 -1
- package/dist/localization/default-messages.d.ts +42 -0
- package/dist/localization/default-messages.d.ts.map +1 -1
- package/dist/localization/default-messages.js +42 -0
- package/dist/localization/default-messages.js.map +1 -1
- package/dist/notifications/routes.d.ts +2 -2
- package/dist/observability/routes.d.ts +1 -1
- package/dist/progress/routes.d.ts +1 -1
- package/dist/server/action-discovery.d.ts.map +1 -1
- package/dist/server/action-discovery.js +12 -0
- package/dist/server/action-discovery.js.map +1 -1
- package/dist/server/action-routes.d.ts +3 -0
- package/dist/server/action-routes.d.ts.map +1 -1
- package/dist/server/action-routes.js +45 -5
- package/dist/server/action-routes.js.map +1 -1
- package/dist/server/agent-chat-plugin.d.ts +6 -0
- package/dist/server/agent-chat-plugin.d.ts.map +1 -1
- package/dist/server/agent-chat-plugin.js +71 -6
- package/dist/server/agent-chat-plugin.js.map +1 -1
- package/dist/server/agent-engine-api-key-route.d.ts +1 -1
- package/dist/server/index.d.ts +1 -0
- package/dist/server/index.d.ts.map +1 -1
- package/dist/server/index.js +1 -0
- package/dist/server/index.js.map +1 -1
- package/dist/settings/org-settings.d.ts +2 -0
- package/dist/settings/org-settings.d.ts.map +1 -1
- package/dist/settings/org-settings.js +5 -1
- package/dist/settings/org-settings.js.map +1 -1
- package/dist/settings/store.d.ts +8 -0
- package/dist/settings/store.d.ts.map +1 -1
- package/dist/settings/store.js +48 -0
- package/dist/settings/store.js.map +1 -1
- package/dist/templates/chat/.agents/skills/feature-flags/SKILL.md +169 -0
- package/dist/templates/default/.agents/skills/feature-flags/SKILL.md +169 -0
- package/dist/templates/default/AGENTS.md +1 -0
- package/dist/templates/headless/.agents/skills/feature-flags/SKILL.md +169 -0
- package/dist/templates/workspace-core/.agents/skills/feature-flags/SKILL.md +169 -0
- package/dist/templates/workspace-core/AGENTS.md +1 -1
- package/dist/templates/workspace-root/AGENTS.md +1 -1
- package/dist/vite/action-types-plugin.d.ts.map +1 -1
- package/dist/vite/action-types-plugin.js +12 -0
- package/dist/vite/action-types-plugin.js.map +1 -1
- package/docs/content/actions.mdx +48 -0
- package/docs/content/locales/ar-SA/actions.mdx +38 -0
- package/docs/content/locales/de-DE/actions.mdx +38 -0
- package/docs/content/locales/es-ES/actions.mdx +38 -0
- package/docs/content/locales/fr-FR/actions.mdx +38 -0
- package/docs/content/locales/hi-IN/actions.mdx +38 -0
- package/docs/content/locales/ja-JP/actions.mdx +38 -0
- package/docs/content/locales/ko-KR/actions.mdx +38 -0
- package/docs/content/locales/pt-BR/actions.mdx +38 -0
- package/docs/content/locales/zh-CN/actions.mdx +38 -0
- package/docs/content/locales/zh-TW/actions.mdx +38 -0
- package/package.json +5 -1
- package/src/templates/chat/.agents/skills/feature-flags/SKILL.md +169 -0
- package/src/templates/default/.agents/skills/feature-flags/SKILL.md +169 -0
- package/src/templates/default/AGENTS.md +1 -0
- package/src/templates/headless/.agents/skills/feature-flags/SKILL.md +169 -0
- package/src/templates/workspace-core/.agents/skills/feature-flags/SKILL.md +169 -0
- package/src/templates/workspace-core/AGENTS.md +1 -1
- package/src/templates/workspace-root/AGENTS.md +1 -1
- package/corpus/templates/clips/actions/get-feature-flags.ts +0 -30
package/corpus/README.md
CHANGED
package/corpus/core/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,17 @@
|
|
|
1
1
|
# @agent-native/core
|
|
2
2
|
|
|
3
|
+
## 0.108.0
|
|
4
|
+
|
|
5
|
+
### Minor Changes
|
|
6
|
+
|
|
7
|
+
- 1db27df: Add shared default-off feature flags with server-side targeting, versioned Analytics fleet-management actions, narrowly delegated A2A access, and reusable controlled editor primitives.
|
|
8
|
+
|
|
9
|
+
## 0.107.2
|
|
10
|
+
|
|
11
|
+
### Patch Changes
|
|
12
|
+
|
|
13
|
+
- 2a4d2db: Retry messaging replies without repeating successful agent mutations, and deliver verified A2A artifact checkpoints as soon as they are durable.
|
|
14
|
+
|
|
3
15
|
## 0.107.1
|
|
4
16
|
|
|
5
17
|
### Patch Changes
|
|
@@ -596,6 +596,54 @@ export default defineAction({
|
|
|
596
596
|
});
|
|
597
597
|
```
|
|
598
598
|
|
|
599
|
+
## Guarding staged features {#feature-flags}
|
|
600
|
+
|
|
601
|
+
Use Core feature flags when an action is safe to deploy but should reach
|
|
602
|
+
production gradually. Declare the default-off flag once, register it from a
|
|
603
|
+
Nitro plugin, and evaluate it inside every guarded action. Hiding the matching
|
|
604
|
+
button is presentation; the action check is enforcement.
|
|
605
|
+
|
|
606
|
+
```ts
|
|
607
|
+
// shared/feature-flags.ts
|
|
608
|
+
import { defineFeatureFlag } from "@agent-native/core/feature-flags";
|
|
609
|
+
|
|
610
|
+
export const FULL_APP_BUILDING = defineFeatureFlag({
|
|
611
|
+
key: "full-app-building",
|
|
612
|
+
displayName: "Full app building",
|
|
613
|
+
description: "Create and edit Fusion-backed applications.",
|
|
614
|
+
});
|
|
615
|
+
```
|
|
616
|
+
|
|
617
|
+
```ts
|
|
618
|
+
// server/plugins/feature-flags.ts
|
|
619
|
+
import { createFeatureFlagsPlugin } from "@agent-native/core/server";
|
|
620
|
+
|
|
621
|
+
import { FULL_APP_BUILDING } from "../../shared/feature-flags.js";
|
|
622
|
+
|
|
623
|
+
export default createFeatureFlagsPlugin({ flags: [FULL_APP_BUILDING] });
|
|
624
|
+
```
|
|
625
|
+
|
|
626
|
+
```ts
|
|
627
|
+
// actions/create-fusion-app.ts
|
|
628
|
+
import { isFeatureFlagEnabled } from "@agent-native/core/feature-flags";
|
|
629
|
+
|
|
630
|
+
run: async (args, ctx) => {
|
|
631
|
+
if (!(await isFeatureFlagEnabled(FULL_APP_BUILDING, ctx))) {
|
|
632
|
+
throw new Error("Full app building is not enabled for this account.");
|
|
633
|
+
}
|
|
634
|
+
// Perform the guarded operation.
|
|
635
|
+
};
|
|
636
|
+
```
|
|
637
|
+
|
|
638
|
+
Use `useFeatureFlag(FULL_APP_BUILDING.key)` from
|
|
639
|
+
`@agent-native/core/client` to hide or reveal the client surface. Core mounts
|
|
640
|
+
`get-feature-flags`, `list-feature-flags`, and `set-feature-flag`. Management
|
|
641
|
+
is permission-checked and audited; fleet operator UIs call the same app-local
|
|
642
|
+
actions through narrowly scoped A2A delegation. Analytics is the sole operator
|
|
643
|
+
UI; apps should not add their own flag settings panels. Never route flag writes
|
|
644
|
+
through generic settings endpoints or raw SQL, and never put authentication,
|
|
645
|
+
authorization, audit, secrets, or SSR cache behavior behind a runtime flag.
|
|
646
|
+
|
|
599
647
|
## Legacy CLI-style actions {#legacy-cli-actions}
|
|
600
648
|
|
|
601
649
|
The framework still supports older `export default async function(args)` actions that aren't wrapped in `defineAction` — useful for one-off dev scripts that don't need agent/HTTP exposure. These are CLI-only; they don't appear as agent tools, don't mount HTTP endpoints, and don't get typesafe frontend hooks.
|
|
@@ -616,6 +616,44 @@ export default defineAction({
|
|
|
616
616
|
});
|
|
617
617
|
```
|
|
618
618
|
|
|
619
|
+
+## حماية الميزات المرحلية {#feature-flags}
|
|
620
|
+
|
|
621
|
+
استخدم أعلام ميزات Core عندما تكون العملية آمنة للنشر لكن ينبغي طرحها تدريجياً في الإنتاج. عرّف العلم المعطّل افتراضياً مرة واحدة، وسجّله من إضافة Nitro، وقيّمه داخل كل عملية محمية. إخفاء الزر المطابق عرضٌ فقط؛ أما فحص العملية فهو الإنفاذ.
|
|
622
|
+
|
|
623
|
+
```ts
|
|
624
|
+
// shared/feature-flags.ts
|
|
625
|
+
import { defineFeatureFlag } from "@agent-native/core/feature-flags";
|
|
626
|
+
|
|
627
|
+
export const FULL_APP_BUILDING = defineFeatureFlag({
|
|
628
|
+
key: "full-app-building",
|
|
629
|
+
displayName: "Full app building",
|
|
630
|
+
description: "Create and edit Fusion-backed applications.",
|
|
631
|
+
});
|
|
632
|
+
```
|
|
633
|
+
|
|
634
|
+
```ts
|
|
635
|
+
// server/plugins/feature-flags.ts
|
|
636
|
+
import { createFeatureFlagsPlugin } from "@agent-native/core/server";
|
|
637
|
+
|
|
638
|
+
import { FULL_APP_BUILDING } from "../../shared/feature-flags.js";
|
|
639
|
+
|
|
640
|
+
export default createFeatureFlagsPlugin({ flags: [FULL_APP_BUILDING] });
|
|
641
|
+
```
|
|
642
|
+
|
|
643
|
+
```ts
|
|
644
|
+
// actions/create-fusion-app.ts
|
|
645
|
+
import { isFeatureFlagEnabled } from "@agent-native/core/feature-flags";
|
|
646
|
+
|
|
647
|
+
run: async (args, ctx) => {
|
|
648
|
+
if (!(await isFeatureFlagEnabled(FULL_APP_BUILDING, ctx))) {
|
|
649
|
+
throw new Error("Full app building is not enabled for this account.");
|
|
650
|
+
}
|
|
651
|
+
// Perform the guarded operation.
|
|
652
|
+
};
|
|
653
|
+
```
|
|
654
|
+
|
|
655
|
+
استخدم `useFeatureFlag(FULL_APP_BUILDING.key)` من `@agent-native/core/client` لإخفاء واجهة العميل أو إظهارها. يوفّر Core الإجراءات `get-feature-flags` و`list-feature-flags` و`set-feature-flag`. تخضع الإدارة لفحص الأذونات والتدقيق؛ وتستدعي واجهات fleet الإجراءات المحلية للتطبيق نفسها عبر تفويض A2A محدود بدقة. لا تمرّر عمليات كتابة الأعلام عبر نقاط نهاية الإعدادات العامة أو SQL الخام، ولا تضع المصادقة أو التفويض أو التدقيق أو الأسرار أو ذاكرة SSR المؤقتة خلف علم وقت تشغيل.
|
|
656
|
+
|
|
619
657
|
## نمط CLI القديم actions {#legacy-cli-actions}
|
|
620
658
|
|
|
621
659
|
لا يزال إطار العمل يدعم `export default async function(args)` actions الأقدم التي لم يتم تضمينها في `defineAction` - وهي مفيدة لنصوص التطوير الفريدة التي لا تحتاج إلى عرض الوكيل/HTTP. هذه هي CLI فقط؛ فهي لا تظهر كأدوات وكيل، ولا تقم بتثبيت نقاط نهاية HTTP، ولا تحصل على خطافات أمامية آمنة للكتابة.
|
|
@@ -618,6 +618,44 @@ export default defineAction({
|
|
|
618
618
|
});
|
|
619
619
|
```
|
|
620
620
|
|
|
621
|
+
+## Staged-Features absichern {#feature-flags}
|
|
622
|
+
|
|
623
|
+
Verwende Core-Feature-Flags, wenn eine Action sicher ausgerollt werden kann, aber schrittweise in Produktion gelangen soll. Definiere das standardmäßig deaktivierte Flag einmal, registriere es über ein Nitro-Plugin und prüfe es in jeder geschützten Action. Die passende Schaltfläche auszublenden ist Darstellung; die Prüfung in der Action ist die Durchsetzung.
|
|
624
|
+
|
|
625
|
+
```ts
|
|
626
|
+
// shared/feature-flags.ts
|
|
627
|
+
import { defineFeatureFlag } from "@agent-native/core/feature-flags";
|
|
628
|
+
|
|
629
|
+
export const FULL_APP_BUILDING = defineFeatureFlag({
|
|
630
|
+
key: "full-app-building",
|
|
631
|
+
displayName: "Full app building",
|
|
632
|
+
description: "Create and edit Fusion-backed applications.",
|
|
633
|
+
});
|
|
634
|
+
```
|
|
635
|
+
|
|
636
|
+
```ts
|
|
637
|
+
// server/plugins/feature-flags.ts
|
|
638
|
+
import { createFeatureFlagsPlugin } from "@agent-native/core/server";
|
|
639
|
+
|
|
640
|
+
import { FULL_APP_BUILDING } from "../../shared/feature-flags.js";
|
|
641
|
+
|
|
642
|
+
export default createFeatureFlagsPlugin({ flags: [FULL_APP_BUILDING] });
|
|
643
|
+
```
|
|
644
|
+
|
|
645
|
+
```ts
|
|
646
|
+
// actions/create-fusion-app.ts
|
|
647
|
+
import { isFeatureFlagEnabled } from "@agent-native/core/feature-flags";
|
|
648
|
+
|
|
649
|
+
run: async (args, ctx) => {
|
|
650
|
+
if (!(await isFeatureFlagEnabled(FULL_APP_BUILDING, ctx))) {
|
|
651
|
+
throw new Error("Full app building is not enabled for this account.");
|
|
652
|
+
}
|
|
653
|
+
// Perform the guarded operation.
|
|
654
|
+
};
|
|
655
|
+
```
|
|
656
|
+
|
|
657
|
+
Verwende `useFeatureFlag(FULL_APP_BUILDING.key)` aus `@agent-native/core/client`, um die Client-Oberfläche ein- oder auszublenden. Core stellt `get-feature-flags`, `list-feature-flags` und `set-feature-flag` bereit. Die Verwaltung wird geprüft und auditiert; Fleet-Oberflächen rufen dieselben app-lokalen Actions über eng begrenzte A2A-Delegierung auf. Leite Flag-Schreibvorgänge niemals über allgemeine Einstellungs-Endpunkte oder unverarbeitetes SQL und lege Authentifizierung, Autorisierung, Auditierung, Secrets oder SSR-Cache-Verhalten niemals hinter ein Laufzeit-Flag.
|
|
658
|
+
|
|
621
659
|
## Legacy CLI-Stil actions {#legacy-cli-actions}
|
|
622
660
|
|
|
623
661
|
Das Framework unterstützt weiterhin ältere `export default async function(args)` actions, die nicht in `defineAction` verpackt sind – nützlich für einmalige Entwicklungsskripte, die keine Agent/HTTP-Offenlegung benötigen. Dies sind nur CLI; Sie erscheinen nicht als Agent-Tools, mounten keine HTTP-Endpunkte und erhalten keine typsicheren Frontend-Hooks.
|
|
@@ -618,6 +618,44 @@ export default defineAction({
|
|
|
618
618
|
});
|
|
619
619
|
```
|
|
620
620
|
|
|
621
|
+
+## Proteger funciones por etapas {#feature-flags}
|
|
622
|
+
|
|
623
|
+
Usa indicadores de funciones de Core cuando una acción sea segura para desplegar, pero deba llegar gradualmente a producción. Declara una vez el indicador desactivado por defecto, regístralo desde un plugin de Nitro y evalúalo dentro de cada acción protegida. Ocultar el botón correspondiente es presentación; la comprobación de la acción es la aplicación de la regla.
|
|
624
|
+
|
|
625
|
+
```ts
|
|
626
|
+
// shared/feature-flags.ts
|
|
627
|
+
import { defineFeatureFlag } from "@agent-native/core/feature-flags";
|
|
628
|
+
|
|
629
|
+
export const FULL_APP_BUILDING = defineFeatureFlag({
|
|
630
|
+
key: "full-app-building",
|
|
631
|
+
displayName: "Full app building",
|
|
632
|
+
description: "Create and edit Fusion-backed applications.",
|
|
633
|
+
});
|
|
634
|
+
```
|
|
635
|
+
|
|
636
|
+
```ts
|
|
637
|
+
// server/plugins/feature-flags.ts
|
|
638
|
+
import { createFeatureFlagsPlugin } from "@agent-native/core/server";
|
|
639
|
+
|
|
640
|
+
import { FULL_APP_BUILDING } from "../../shared/feature-flags.js";
|
|
641
|
+
|
|
642
|
+
export default createFeatureFlagsPlugin({ flags: [FULL_APP_BUILDING] });
|
|
643
|
+
```
|
|
644
|
+
|
|
645
|
+
```ts
|
|
646
|
+
// actions/create-fusion-app.ts
|
|
647
|
+
import { isFeatureFlagEnabled } from "@agent-native/core/feature-flags";
|
|
648
|
+
|
|
649
|
+
run: async (args, ctx) => {
|
|
650
|
+
if (!(await isFeatureFlagEnabled(FULL_APP_BUILDING, ctx))) {
|
|
651
|
+
throw new Error("Full app building is not enabled for this account.");
|
|
652
|
+
}
|
|
653
|
+
// Perform the guarded operation.
|
|
654
|
+
};
|
|
655
|
+
```
|
|
656
|
+
|
|
657
|
+
Usa `useFeatureFlag(FULL_APP_BUILDING.key)` de `@agent-native/core/client` para ocultar o mostrar la superficie del cliente. Core proporciona `get-feature-flags`, `list-feature-flags` y `set-feature-flag`. La administración comprueba permisos y queda auditada; las interfaces de flota llaman las mismas actions locales de la app mediante delegación A2A restringida. Nunca canalices escrituras de indicadores mediante endpoints genéricos de configuración o SQL sin procesar, ni coloques autenticación, autorización, auditoría, secretos o caché SSR detrás de un indicador de tiempo de ejecución.
|
|
658
|
+
|
|
621
659
|
## actions estilo CLI heredado {#legacy-cli-actions}
|
|
622
660
|
|
|
623
661
|
El marco aún admite `export default async function(args)` actions más antiguos que no están incluidos en `defineAction`, lo que resulta útil para scripts de desarrollo únicos que no necesitan exposición al agente/HTTP. Estos son solo para CLI; no aparecen como herramientas de agente, no montan puntos finales HTTP y no obtienen enlaces de interfaz con seguridad tipográfica.
|
|
@@ -618,6 +618,44 @@ export default defineAction({
|
|
|
618
618
|
});
|
|
619
619
|
```
|
|
620
620
|
|
|
621
|
+
+## Protéger les fonctionnalités progressives {#feature-flags}
|
|
622
|
+
|
|
623
|
+
Utilisez les indicateurs de fonctionnalités Core lorsqu’une action peut être déployée en toute sécurité, mais doit atteindre progressivement la production. Déclarez une fois l’indicateur désactivé par défaut, enregistrez-le depuis un plugin Nitro et évaluez-le dans chaque action protégée. Masquer le bouton correspondant relève de la présentation ; le contrôle dans l’action assure l’application.
|
|
624
|
+
|
|
625
|
+
```ts
|
|
626
|
+
// shared/feature-flags.ts
|
|
627
|
+
import { defineFeatureFlag } from "@agent-native/core/feature-flags";
|
|
628
|
+
|
|
629
|
+
export const FULL_APP_BUILDING = defineFeatureFlag({
|
|
630
|
+
key: "full-app-building",
|
|
631
|
+
displayName: "Full app building",
|
|
632
|
+
description: "Create and edit Fusion-backed applications.",
|
|
633
|
+
});
|
|
634
|
+
```
|
|
635
|
+
|
|
636
|
+
```ts
|
|
637
|
+
// server/plugins/feature-flags.ts
|
|
638
|
+
import { createFeatureFlagsPlugin } from "@agent-native/core/server";
|
|
639
|
+
|
|
640
|
+
import { FULL_APP_BUILDING } from "../../shared/feature-flags.js";
|
|
641
|
+
|
|
642
|
+
export default createFeatureFlagsPlugin({ flags: [FULL_APP_BUILDING] });
|
|
643
|
+
```
|
|
644
|
+
|
|
645
|
+
```ts
|
|
646
|
+
// actions/create-fusion-app.ts
|
|
647
|
+
import { isFeatureFlagEnabled } from "@agent-native/core/feature-flags";
|
|
648
|
+
|
|
649
|
+
run: async (args, ctx) => {
|
|
650
|
+
if (!(await isFeatureFlagEnabled(FULL_APP_BUILDING, ctx))) {
|
|
651
|
+
throw new Error("Full app building is not enabled for this account.");
|
|
652
|
+
}
|
|
653
|
+
// Perform the guarded operation.
|
|
654
|
+
};
|
|
655
|
+
```
|
|
656
|
+
|
|
657
|
+
Utilisez `useFeatureFlag(FULL_APP_BUILDING.key)` depuis `@agent-native/core/client` pour masquer ou afficher la surface cliente. Core fournit `get-feature-flags`, `list-feature-flags` et `set-feature-flag`. La gestion vérifie les autorisations et est auditée ; les interfaces de flotte appellent les mêmes actions locales à l’app via une délégation A2A étroitement limitée. Ne faites jamais transiter les écritures d’indicateurs par des endpoints de réglages génériques ou du SQL brut, et ne placez jamais l’authentification, l’autorisation, l’audit, les secrets ou le cache SSR derrière un indicateur d’exécution.
|
|
658
|
+
|
|
621
659
|
## actions de style CLI hérité {#legacy-cli-actions}
|
|
622
660
|
|
|
623
661
|
Le framework prend toujours en charge les anciens `export default async function(args)` actions qui ne sont pas encapsulés dans `defineAction` — utile pour les scripts de développement ponctuels qui ne nécessitent pas d'exposition agent/HTTP. Il s'agit uniquement de CLI ; ils n'apparaissent pas en tant qu'outils d'agent, ne montent pas de points de terminaison HTTP et n'obtiennent pas de hooks frontaux de type sécurisé.
|
|
@@ -614,6 +614,44 @@ export default defineAction({
|
|
|
614
614
|
});
|
|
615
615
|
```
|
|
616
616
|
|
|
617
|
+
+## चरणबद्ध सुविधाओं की सुरक्षा {#feature-flags}
|
|
618
|
+
|
|
619
|
+
Core फीचर फ़्लैग का उपयोग तब करें जब कोई action सुरक्षित रूप से deploy की जा सकती हो, लेकिन production तक धीरे-धीरे पहुँचनी हो। डिफ़ॉल्ट रूप से बंद फ़्लैग को एक बार घोषित करें, Nitro plugin से register करें और हर guarded action में evaluate करें। संबंधित बटन छिपाना केवल प्रस्तुति है; action check ही enforcement है।
|
|
620
|
+
|
|
621
|
+
```ts
|
|
622
|
+
// shared/feature-flags.ts
|
|
623
|
+
import { defineFeatureFlag } from "@agent-native/core/feature-flags";
|
|
624
|
+
|
|
625
|
+
export const FULL_APP_BUILDING = defineFeatureFlag({
|
|
626
|
+
key: "full-app-building",
|
|
627
|
+
displayName: "Full app building",
|
|
628
|
+
description: "Create and edit Fusion-backed applications.",
|
|
629
|
+
});
|
|
630
|
+
```
|
|
631
|
+
|
|
632
|
+
```ts
|
|
633
|
+
// server/plugins/feature-flags.ts
|
|
634
|
+
import { createFeatureFlagsPlugin } from "@agent-native/core/server";
|
|
635
|
+
|
|
636
|
+
import { FULL_APP_BUILDING } from "../../shared/feature-flags.js";
|
|
637
|
+
|
|
638
|
+
export default createFeatureFlagsPlugin({ flags: [FULL_APP_BUILDING] });
|
|
639
|
+
```
|
|
640
|
+
|
|
641
|
+
```ts
|
|
642
|
+
// actions/create-fusion-app.ts
|
|
643
|
+
import { isFeatureFlagEnabled } from "@agent-native/core/feature-flags";
|
|
644
|
+
|
|
645
|
+
run: async (args, ctx) => {
|
|
646
|
+
if (!(await isFeatureFlagEnabled(FULL_APP_BUILDING, ctx))) {
|
|
647
|
+
throw new Error("Full app building is not enabled for this account.");
|
|
648
|
+
}
|
|
649
|
+
// Perform the guarded operation.
|
|
650
|
+
};
|
|
651
|
+
```
|
|
652
|
+
|
|
653
|
+
क्लाइंट सतह को छिपाने या दिखाने के लिए `@agent-native/core/client` से `useFeatureFlag(FULL_APP_BUILDING.key)` का उपयोग करें। Core `get-feature-flags`, `list-feature-flags`, और `set-feature-flag` उपलब्ध कराता है। प्रबंधन में अनुमतियों की जाँच और audit होता है; fleet UI सख्ती से सीमित A2A delegation के जरिए वही app-local actions कॉल करता है। फ़्लैग writes को सामान्य settings endpoints या raw SQL से route न करें, और authentication, authorization, audit, secrets या SSR cache को runtime flag के पीछे न रखें।
|
|
654
|
+
|
|
617
655
|
## विरासत CLI-शैली actions {#legacy-cli-actions}
|
|
618
656
|
|
|
619
657
|
फ्रेमवर्क अभी भी पुराने `export default async function(args)` actions का समर्थन करता है जो `defineAction` में लिपटे नहीं हैं - एक-ऑफ़ देव स्क्रिप्ट के लिए उपयोगी है जिन्हें एजेंट/HTTP एक्सपोज़र की आवश्यकता नहीं है। ये केवल CLI हैं; वे एजेंट टूल के रूप में प्रकट नहीं होते हैं, HTTP एंडपॉइंट को माउंट नहीं करते हैं, और उन्हें टाइपसेफ फ्रंटएंड हुक नहीं मिलते हैं।
|
|
@@ -618,6 +618,44 @@ export default defineAction({
|
|
|
618
618
|
});
|
|
619
619
|
```
|
|
620
620
|
|
|
621
|
+
+## 段階的な機能を保護する {#feature-flags}
|
|
622
|
+
|
|
623
|
+
安全にデプロイできるものの、本番へ段階的に届けたい action には Core の feature flag を使用します。デフォルトでオフの flag を一度だけ宣言し、Nitro プラグインから登録して、保護するすべての action 内で評価します。対応するボタンを隠すのは表示上の処理であり、action のチェックが強制です。
|
|
624
|
+
|
|
625
|
+
```ts
|
|
626
|
+
// shared/feature-flags.ts
|
|
627
|
+
import { defineFeatureFlag } from "@agent-native/core/feature-flags";
|
|
628
|
+
|
|
629
|
+
export const FULL_APP_BUILDING = defineFeatureFlag({
|
|
630
|
+
key: "full-app-building",
|
|
631
|
+
displayName: "Full app building",
|
|
632
|
+
description: "Create and edit Fusion-backed applications.",
|
|
633
|
+
});
|
|
634
|
+
```
|
|
635
|
+
|
|
636
|
+
```ts
|
|
637
|
+
// server/plugins/feature-flags.ts
|
|
638
|
+
import { createFeatureFlagsPlugin } from "@agent-native/core/server";
|
|
639
|
+
|
|
640
|
+
import { FULL_APP_BUILDING } from "../../shared/feature-flags.js";
|
|
641
|
+
|
|
642
|
+
export default createFeatureFlagsPlugin({ flags: [FULL_APP_BUILDING] });
|
|
643
|
+
```
|
|
644
|
+
|
|
645
|
+
```ts
|
|
646
|
+
// actions/create-fusion-app.ts
|
|
647
|
+
import { isFeatureFlagEnabled } from "@agent-native/core/feature-flags";
|
|
648
|
+
|
|
649
|
+
run: async (args, ctx) => {
|
|
650
|
+
if (!(await isFeatureFlagEnabled(FULL_APP_BUILDING, ctx))) {
|
|
651
|
+
throw new Error("Full app building is not enabled for this account.");
|
|
652
|
+
}
|
|
653
|
+
// Perform the guarded operation.
|
|
654
|
+
};
|
|
655
|
+
```
|
|
656
|
+
|
|
657
|
+
クライアント側の表示を隠したり表示したりするには、`@agent-native/core/client` の `useFeatureFlag(FULL_APP_BUILDING.key)` を使用します。Core は `get-feature-flags`、`list-feature-flags`、`set-feature-flag` を提供します。管理操作では権限が確認され監査され、fleet UI は厳密に限定された A2A 委任で同じアプリローカル actions を呼び出します。flag の書き込みを汎用設定 endpoint や生の SQL 経由にしたり、認証、認可、監査、secret、SSR キャッシュを runtime flag の背後に置いたりしないでください。
|
|
658
|
+
|
|
621
659
|
## レガシー CLI スタイル actions {#legacy-cli-actions}
|
|
622
660
|
|
|
623
661
|
フレームワークは、`defineAction` でラップされていない古い `export default async function(args)` actions を引き続きサポートしています。これは、エージェント/HTTP の公開を必要としない 1 回限りの開発スクリプトに役立ちます。これらは CLI のみです。これらはエージェント ツールとして表示されず、HTTP エンドポイントをマウントせず、タイプセーフなフロントエンド フックを取得しません。
|
|
@@ -614,6 +614,44 @@ export default defineAction({
|
|
|
614
614
|
});
|
|
615
615
|
```
|
|
616
616
|
|
|
617
|
+
+## 단계적 기능 보호하기 {#feature-flags}
|
|
618
|
+
|
|
619
|
+
배포 자체는 안전하지만 프로덕션에 점진적으로 도입해야 하는 action에는 Core feature flag를 사용하세요. 기본적으로 꺼진 flag를 한 번 선언하고 Nitro 플러그인에서 등록한 뒤 모든 보호된 action 안에서 평가하세요. 해당 버튼을 숨기는 것은 표현일 뿐이며, action 검사가 실제 적용입니다.
|
|
620
|
+
|
|
621
|
+
```ts
|
|
622
|
+
// shared/feature-flags.ts
|
|
623
|
+
import { defineFeatureFlag } from "@agent-native/core/feature-flags";
|
|
624
|
+
|
|
625
|
+
export const FULL_APP_BUILDING = defineFeatureFlag({
|
|
626
|
+
key: "full-app-building",
|
|
627
|
+
displayName: "Full app building",
|
|
628
|
+
description: "Create and edit Fusion-backed applications.",
|
|
629
|
+
});
|
|
630
|
+
```
|
|
631
|
+
|
|
632
|
+
```ts
|
|
633
|
+
// server/plugins/feature-flags.ts
|
|
634
|
+
import { createFeatureFlagsPlugin } from "@agent-native/core/server";
|
|
635
|
+
|
|
636
|
+
import { FULL_APP_BUILDING } from "../../shared/feature-flags.js";
|
|
637
|
+
|
|
638
|
+
export default createFeatureFlagsPlugin({ flags: [FULL_APP_BUILDING] });
|
|
639
|
+
```
|
|
640
|
+
|
|
641
|
+
```ts
|
|
642
|
+
// actions/create-fusion-app.ts
|
|
643
|
+
import { isFeatureFlagEnabled } from "@agent-native/core/feature-flags";
|
|
644
|
+
|
|
645
|
+
run: async (args, ctx) => {
|
|
646
|
+
if (!(await isFeatureFlagEnabled(FULL_APP_BUILDING, ctx))) {
|
|
647
|
+
throw new Error("Full app building is not enabled for this account.");
|
|
648
|
+
}
|
|
649
|
+
// Perform the guarded operation.
|
|
650
|
+
};
|
|
651
|
+
```
|
|
652
|
+
|
|
653
|
+
클라이언트 화면을 숨기거나 표시하려면 `@agent-native/core/client`의 `useFeatureFlag(FULL_APP_BUILDING.key)`를 사용하세요. Core는 `get-feature-flags`, `list-feature-flags`, `set-feature-flag`를 제공합니다. 관리는 권한 검사와 감사를 거치며, fleet UI는 엄격히 제한된 A2A 위임으로 같은 앱 로컬 actions를 호출합니다. flag 쓰기를 일반 설정 endpoint나 원시 SQL로 처리하지 말고, 인증, 권한 부여, 감사, secret 또는 SSR 캐시를 runtime flag 뒤에 두지 마세요.
|
|
654
|
+
|
|
617
655
|
## 레거시 CLI 스타일 actions {#legacy-cli-actions}
|
|
618
656
|
|
|
619
657
|
프레임워크는 `defineAction`에 래핑되지 않은 이전 `export default async function(args)` actions를 계속 지원합니다. 이는 에이전트/HTTP 노출이 필요하지 않은 일회성 개발 스크립트에 유용합니다. 이는 CLI 전용입니다. 에이전트 도구로 표시되지 않고, HTTP 엔드포인트를 마운트하지 않으며, 유형 안전 프런트엔드 후크를 얻지 못합니다.
|
|
@@ -618,6 +618,44 @@ export default defineAction({
|
|
|
618
618
|
});
|
|
619
619
|
```
|
|
620
620
|
|
|
621
|
+
+## Protegendo recursos em etapas {#feature-flags}
|
|
622
|
+
|
|
623
|
+
Use feature flags do Core quando uma action for segura para implantar, mas precisar chegar gradualmente à produção. Declare a flag desativada por padrão uma vez, registre-a em um plugin Nitro e avalie-a dentro de cada action protegida. Ocultar o botão correspondente é apresentação; a verificação na action é a aplicação da regra.
|
|
624
|
+
|
|
625
|
+
```ts
|
|
626
|
+
// shared/feature-flags.ts
|
|
627
|
+
import { defineFeatureFlag } from "@agent-native/core/feature-flags";
|
|
628
|
+
|
|
629
|
+
export const FULL_APP_BUILDING = defineFeatureFlag({
|
|
630
|
+
key: "full-app-building",
|
|
631
|
+
displayName: "Full app building",
|
|
632
|
+
description: "Create and edit Fusion-backed applications.",
|
|
633
|
+
});
|
|
634
|
+
```
|
|
635
|
+
|
|
636
|
+
```ts
|
|
637
|
+
// server/plugins/feature-flags.ts
|
|
638
|
+
import { createFeatureFlagsPlugin } from "@agent-native/core/server";
|
|
639
|
+
|
|
640
|
+
import { FULL_APP_BUILDING } from "../../shared/feature-flags.js";
|
|
641
|
+
|
|
642
|
+
export default createFeatureFlagsPlugin({ flags: [FULL_APP_BUILDING] });
|
|
643
|
+
```
|
|
644
|
+
|
|
645
|
+
```ts
|
|
646
|
+
// actions/create-fusion-app.ts
|
|
647
|
+
import { isFeatureFlagEnabled } from "@agent-native/core/feature-flags";
|
|
648
|
+
|
|
649
|
+
run: async (args, ctx) => {
|
|
650
|
+
if (!(await isFeatureFlagEnabled(FULL_APP_BUILDING, ctx))) {
|
|
651
|
+
throw new Error("Full app building is not enabled for this account.");
|
|
652
|
+
}
|
|
653
|
+
// Perform the guarded operation.
|
|
654
|
+
};
|
|
655
|
+
```
|
|
656
|
+
|
|
657
|
+
Use `useFeatureFlag(FULL_APP_BUILDING.key)` de `@agent-native/core/client` para ocultar ou revelar a superfície do cliente. O Core disponibiliza `get-feature-flags`, `list-feature-flags` e `set-feature-flag`. O gerenciamento verifica permissões e é auditado; interfaces de frota chamam as mesmas actions locais do app por delegação A2A estritamente limitada. Nunca encaminhe gravações de flags por endpoints genéricos de configurações ou SQL bruto, nem coloque autenticação, autorização, auditoria, segredos ou cache SSR atrás de uma flag de runtime.
|
|
658
|
+
|
|
621
659
|
## actions estilo CLI legado {#legacy-cli-actions}
|
|
622
660
|
|
|
623
661
|
A estrutura ainda oferece suporte a `export default async function(args)` actions mais antigos que não estão agrupados em `defineAction` — útil para scripts de desenvolvimento únicos que não precisam de exposição do agente/HTTP. Estes são apenas CLI; eles não aparecem como ferramentas de agente, não montam endpoints HTTP e não recebem ganchos de front-end seguros.
|
|
@@ -616,6 +616,44 @@ export default defineAction({
|
|
|
616
616
|
});
|
|
617
617
|
```
|
|
618
618
|
|
|
619
|
+
+## 保护分阶段功能 {#feature-flags}
|
|
620
|
+
|
|
621
|
+
当某个 action 可以安全部署、但需要逐步进入生产环境时,请使用 Core 功能标志。只需声明一次默认关闭的标志,从 Nitro 插件注册它,并在每个受保护的 action 中进行评估。隐藏对应按钮只是界面呈现;action 检查才是强制执行。
|
|
622
|
+
|
|
623
|
+
```ts
|
|
624
|
+
// shared/feature-flags.ts
|
|
625
|
+
import { defineFeatureFlag } from "@agent-native/core/feature-flags";
|
|
626
|
+
|
|
627
|
+
export const FULL_APP_BUILDING = defineFeatureFlag({
|
|
628
|
+
key: "full-app-building",
|
|
629
|
+
displayName: "Full app building",
|
|
630
|
+
description: "Create and edit Fusion-backed applications.",
|
|
631
|
+
});
|
|
632
|
+
```
|
|
633
|
+
|
|
634
|
+
```ts
|
|
635
|
+
// server/plugins/feature-flags.ts
|
|
636
|
+
import { createFeatureFlagsPlugin } from "@agent-native/core/server";
|
|
637
|
+
|
|
638
|
+
import { FULL_APP_BUILDING } from "../../shared/feature-flags.js";
|
|
639
|
+
|
|
640
|
+
export default createFeatureFlagsPlugin({ flags: [FULL_APP_BUILDING] });
|
|
641
|
+
```
|
|
642
|
+
|
|
643
|
+
```ts
|
|
644
|
+
// actions/create-fusion-app.ts
|
|
645
|
+
import { isFeatureFlagEnabled } from "@agent-native/core/feature-flags";
|
|
646
|
+
|
|
647
|
+
run: async (args, ctx) => {
|
|
648
|
+
if (!(await isFeatureFlagEnabled(FULL_APP_BUILDING, ctx))) {
|
|
649
|
+
throw new Error("Full app building is not enabled for this account.");
|
|
650
|
+
}
|
|
651
|
+
// Perform the guarded operation.
|
|
652
|
+
};
|
|
653
|
+
```
|
|
654
|
+
|
|
655
|
+
使用 `@agent-native/core/client` 中的 `useFeatureFlag(FULL_APP_BUILDING.key)` 隐藏或显示客户端界面。Core 提供 `get-feature-flags`、`list-feature-flags` 和 `set-feature-flag`。管理会检查权限并审计;fleet UI 通过严格限定的 A2A 委托调用相同的应用本地 actions。切勿通过通用设置 endpoint 或原始 SQL 写入标志,也不要将身份验证、授权、审计、secret 或 SSR 缓存置于 runtime flag 之后。
|
|
656
|
+
|
|
619
657
|
## 旧版 CLI 样式 actions {#legacy-cli-actions}
|
|
620
658
|
|
|
621
659
|
该框架仍然支持未包含在 `defineAction` 中的较旧的 `export default async function(args)` actions - 对于不需要代理/HTTP 暴露的一次性开发脚本很有用。这些仅限 CLI;它们不会显示为代理工具,不会挂载 HTTP 端点,也不会获得类型安全的前端挂钩。
|
|
@@ -614,6 +614,44 @@ export default defineAction({
|
|
|
614
614
|
});
|
|
615
615
|
```
|
|
616
616
|
|
|
617
|
+
+## 保護分階段功能 {#feature-flags}
|
|
618
|
+
|
|
619
|
+
當某個 action 可以安全部署、但需要逐步進入生產環境時,請使用 Core 功能旗標。只需宣告一次預設關閉的旗標,從 Nitro 外掛程式註冊它,並在每個受保護的 action 中評估。隱藏對應按鈕只是介面呈現;action 檢查才是強制執行。
|
|
620
|
+
|
|
621
|
+
```ts
|
|
622
|
+
// shared/feature-flags.ts
|
|
623
|
+
import { defineFeatureFlag } from "@agent-native/core/feature-flags";
|
|
624
|
+
|
|
625
|
+
export const FULL_APP_BUILDING = defineFeatureFlag({
|
|
626
|
+
key: "full-app-building",
|
|
627
|
+
displayName: "Full app building",
|
|
628
|
+
description: "Create and edit Fusion-backed applications.",
|
|
629
|
+
});
|
|
630
|
+
```
|
|
631
|
+
|
|
632
|
+
```ts
|
|
633
|
+
// server/plugins/feature-flags.ts
|
|
634
|
+
import { createFeatureFlagsPlugin } from "@agent-native/core/server";
|
|
635
|
+
|
|
636
|
+
import { FULL_APP_BUILDING } from "../../shared/feature-flags.js";
|
|
637
|
+
|
|
638
|
+
export default createFeatureFlagsPlugin({ flags: [FULL_APP_BUILDING] });
|
|
639
|
+
```
|
|
640
|
+
|
|
641
|
+
```ts
|
|
642
|
+
// actions/create-fusion-app.ts
|
|
643
|
+
import { isFeatureFlagEnabled } from "@agent-native/core/feature-flags";
|
|
644
|
+
|
|
645
|
+
run: async (args, ctx) => {
|
|
646
|
+
if (!(await isFeatureFlagEnabled(FULL_APP_BUILDING, ctx))) {
|
|
647
|
+
throw new Error("Full app building is not enabled for this account.");
|
|
648
|
+
}
|
|
649
|
+
// Perform the guarded operation.
|
|
650
|
+
};
|
|
651
|
+
```
|
|
652
|
+
|
|
653
|
+
使用 `@agent-native/core/client` 中的 `useFeatureFlag(FULL_APP_BUILDING.key)` 隱藏或顯示用戶端介面。Core 提供 `get-feature-flags`、`list-feature-flags` 和 `set-feature-flag`。管理會檢查權限並稽核;fleet UI 透過嚴格限定的 A2A 委派呼叫相同的應用程式本機 actions。切勿透過通用設定 endpoint 或原始 SQL 寫入旗標,也不要將驗證、授權、稽核、secret 或 SSR 快取置於 runtime flag 之後。
|
|
654
|
+
|
|
617
655
|
## 舊版 CLI 樣式 actions {#legacy-cli-actions}
|
|
618
656
|
|
|
619
657
|
此框架仍然支援未包含在 `defineAction` 中的較舊的 `export default async function(args)` actions - 對於不需要代理/HTTP 暴露的一次性開發指令碼很有用。這些僅限 CLI;它們不會顯示為代理工具,不會掛載 HTTP 端點,也不會獲得型別安全的前端掛鉤。
|
package/corpus/core/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@agent-native/core",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.108.0",
|
|
4
4
|
"description": "Framework for agent-native application development — where AI agents and UI share SQL state, actions, and context",
|
|
5
5
|
"homepage": "https://github.com/BuilderIO/agent-native#readme",
|
|
6
6
|
"bugs": {
|
|
@@ -110,6 +110,10 @@
|
|
|
110
110
|
},
|
|
111
111
|
"./application-state": "./dist/application-state/index.js",
|
|
112
112
|
"./settings": "./dist/settings/index.js",
|
|
113
|
+
"./feature-flags": "./dist/feature-flags/index.js",
|
|
114
|
+
"./feature-flags/actions/get-feature-flags": "./dist/feature-flags/actions/get-feature-flags.js",
|
|
115
|
+
"./feature-flags/actions/list-feature-flags": "./dist/feature-flags/actions/list-feature-flags.js",
|
|
116
|
+
"./feature-flags/actions/set-feature-flag": "./dist/feature-flags/actions/set-feature-flag.js",
|
|
113
117
|
"./localization": "./dist/localization/index.js",
|
|
114
118
|
"./localization/actions/get-localization-preference": "./dist/localization/actions/get-localization-preference.js",
|
|
115
119
|
"./localization/actions/set-localization-preference": "./dist/localization/actions/set-localization-preference.js",
|
|
@@ -11,6 +11,11 @@ export interface A2AArtifactResponseOptions {
|
|
|
11
11
|
baseUrl?: string;
|
|
12
12
|
includeReferencedArtifacts?: boolean;
|
|
13
13
|
includePersistedArtifactMarker?: boolean;
|
|
14
|
+
persistedArtifactSecret?: string;
|
|
15
|
+
}
|
|
16
|
+
|
|
17
|
+
export interface A2AArtifactIdentityOptions {
|
|
18
|
+
persistedArtifactSecrets?: readonly string[];
|
|
14
19
|
}
|
|
15
20
|
|
|
16
21
|
export interface A2AArtifactIdentity {
|
|
@@ -74,21 +79,26 @@ const ARTIFACT_RESOURCE_TYPES = new Set<A2AArtifactIdentity["resourceType"]>([
|
|
|
74
79
|
|
|
75
80
|
function persistedArtifactIdentitiesFromMarker(
|
|
76
81
|
result: string,
|
|
82
|
+
secrets: readonly string[] = process.env.A2A_SECRET
|
|
83
|
+
? [process.env.A2A_SECRET]
|
|
84
|
+
: [],
|
|
77
85
|
): A2AArtifactIdentity[] {
|
|
78
|
-
|
|
79
|
-
if (!secret) return [];
|
|
86
|
+
if (secrets.length === 0) return [];
|
|
80
87
|
const match = result.match(
|
|
81
88
|
/<!--\s*agent-native:persisted-artifacts=([A-Za-z0-9_-]+)\.([a-f0-9]{64})\s*-->/,
|
|
82
89
|
);
|
|
83
90
|
if (!match) return [];
|
|
84
91
|
try {
|
|
85
92
|
const payload = match[1];
|
|
86
|
-
const expected = createHmac("sha256", secret).update(payload).digest();
|
|
87
93
|
const supplied = Buffer.from(match[2], "hex");
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
94
|
+
const verified = secrets.some((secret) => {
|
|
95
|
+
const expected = createHmac("sha256", secret).update(payload).digest();
|
|
96
|
+
return (
|
|
97
|
+
supplied.length === expected.length &&
|
|
98
|
+
timingSafeEqual(supplied, expected)
|
|
99
|
+
);
|
|
100
|
+
});
|
|
101
|
+
if (!verified) {
|
|
92
102
|
return [];
|
|
93
103
|
}
|
|
94
104
|
const parsed = JSON.parse(Buffer.from(payload, "base64url").toString());
|
|
@@ -114,9 +124,15 @@ function persistedArtifactIdentitiesFromMarker(
|
|
|
114
124
|
function withPersistedArtifactMarker(
|
|
115
125
|
text: string,
|
|
116
126
|
toolResults: A2AToolResultSummary[],
|
|
127
|
+
secret = process.env.A2A_SECRET,
|
|
117
128
|
): string {
|
|
118
|
-
const
|
|
119
|
-
|
|
129
|
+
const verificationSecrets = [secret, process.env.A2A_SECRET].filter(
|
|
130
|
+
(value, index, values): value is string =>
|
|
131
|
+
!!value && values.indexOf(value) === index,
|
|
132
|
+
);
|
|
133
|
+
const identities = extractA2AArtifactIdentities(toolResults, {
|
|
134
|
+
persistedArtifactSecrets: verificationSecrets,
|
|
135
|
+
}).slice(0, 12);
|
|
120
136
|
if (identities.length === 0 || !secret) return text;
|
|
121
137
|
const payload = Buffer.from(JSON.stringify(identities)).toString("base64url");
|
|
122
138
|
const signature = createHmac("sha256", secret).update(payload).digest("hex");
|
|
@@ -881,6 +897,7 @@ function collectArtifacts(results: A2AToolResultSummary[]): {
|
|
|
881
897
|
*/
|
|
882
898
|
export function extractA2AArtifactIdentities(
|
|
883
899
|
results: A2AToolResultSummary[],
|
|
900
|
+
options: A2AArtifactIdentityOptions = {},
|
|
884
901
|
): A2AArtifactIdentity[] {
|
|
885
902
|
const identities = new Map<string, A2AArtifactIdentity>();
|
|
886
903
|
|
|
@@ -894,6 +911,7 @@ export function extractA2AArtifactIdentities(
|
|
|
894
911
|
if (result.tool === "call-agent") {
|
|
895
912
|
for (const identity of persistedArtifactIdentitiesFromMarker(
|
|
896
913
|
result.result,
|
|
914
|
+
options.persistedArtifactSecrets,
|
|
897
915
|
)) {
|
|
898
916
|
remember({ ...identity, sourceAction: "call-agent" });
|
|
899
917
|
}
|
|
@@ -1387,7 +1405,11 @@ export function appendA2AArtifactLinks(
|
|
|
1387
1405
|
options.includeReferencedArtifacts ?? false;
|
|
1388
1406
|
const finalize = (value: string) =>
|
|
1389
1407
|
options.includePersistedArtifactMarker
|
|
1390
|
-
? withPersistedArtifactMarker(
|
|
1408
|
+
? withPersistedArtifactMarker(
|
|
1409
|
+
value,
|
|
1410
|
+
toolResults,
|
|
1411
|
+
options.persistedArtifactSecret ?? process.env.A2A_SECRET,
|
|
1412
|
+
)
|
|
1391
1413
|
: value;
|
|
1392
1414
|
const {
|
|
1393
1415
|
documents,
|