This commit is contained in:
2026-04-24 12:21:33 +08:00
parent 3528980645
commit 70b5a7cf73
515 changed files with 14971 additions and 6831 deletions

View File

@@ -13,14 +13,14 @@ VITE_LLM_PROXY_BASE_URL="/api/llm"
# Optional frontend override for the local custom-world scene image proxy path.
VITE_SCENE_IMAGE_PROXY_BASE_URL="/api/custom-world/scene-image"
# Local Node backend address and target used by Vite's dev proxy for runtime API routes.
# Legacy Node backend address. Do not use for new runtime routes.
NODE_SERVER_ADDR=":8081"
NODE_SERVER_TARGET="http://127.0.0.1:8081"
# M7 backend cutover switch for local/gray dev proxy.
# Keep `node` by default. Set to `rust` to point Vite dev proxy at the Rust Axum server.
GENARRATIVE_BACKEND_STACK="node"
RUST_SERVER_TARGET="http://127.0.0.1:3000"
# Backend switch for local dev proxy.
# Runtime API routes default to Rust Axum api-server.
GENARRATIVE_BACKEND_STACK="rust"
RUST_SERVER_TARGET="http://127.0.0.1:3100"
# Optional hard override. When set, it wins over GENARRATIVE_BACKEND_STACK/NODE_SERVER_TARGET/RUST_SERVER_TARGET.
GENARRATIVE_RUNTIME_SERVER_TARGET=""

View File

@@ -1,4 +1,4 @@
VITE_LLM_BASE_URL="https://ark.cn-beijing.volces.com/api/v3"
VITE_LLM_BASE_URL="https://ark.cn-beijing.volces.com/api/v3"
LLM_API_KEY="eb750614-e0b5-402a-bfea-4224862d251e"
ARK_API_KEY="eb750614-e0b5-402a-bfea-4224862d251e"
ARK_CHARACTER_VIDEO_BASE_URL="https://ark.cn-beijing.volces.com/api/v3"
@@ -46,3 +46,8 @@ ALIYUN_OSS_REGION="oss-cn-beijing"
ALIYUN_OSS_ENDPOINT="oss-cn-beijing.aliyuncs.com"
ALIYUN_OSS_ACCESS_KEY_ID="LTAI5t7aiyw6uDFW4miJvU8f"
ALIYUN_OSS_ACCESS_KEY_SECRET="XblWGE6CO1WLnSBdMRVpL6lut4GSoS"
# Local Rust backend target for Vite dev proxy.
GENARRATIVE_BACKEND_STACK="rust"
RUST_SERVER_TARGET="http://127.0.0.1:3100"
GENARRATIVE_API_TARGET="http://127.0.0.1:3100"

View File

@@ -0,0 +1,40 @@
# server-node 冻结隔离说明2026-04-24
## 1. 当前状态
`server-node/` 已进入冻结隔离状态,不再作为可运行、可扩展、可引用的后端工程使用。
冻结原因:项目后端主线已经切到 `server-rs/` 的 Rust + SpacetimeDB 多 crate 方案,继续保留可执行的 `server-node/` 入口会误导后续开发并增加提示词资产、AI 工作流与运行态逻辑的迁移漂移风险。
## 2. 冻结边界
1. 禁止新增任何以 `server-node/` 为目标的运行脚本、开发入口、CI 入口或工程依赖。
2. 禁止新增从前端、Rust 后端、脚本或配置主动调用 `server-node/` 的逻辑。
3. 禁止在 `server-node/` 内继续新增业务能力;后续能力必须落到 `server-rs/` 对应 crate。
4. 历史文档、审计文档、迁移基线中允许保留 `server-node/` 作为旧系统来源说明,但不得把它描述成当前推荐实现。
5. 删除 `server-node/` 前,必须先完成提示词资产与提示词相关工作流的最终迁移确认。
## 3. 删除前阻断项
以下资产仍需要在删除目录前逐项确认迁移或废弃:
1. `server-node/src/prompts/customWorldEntityPrompts.ts`:自定义世界实体生成 prompt。
2. `server-node/src/prompts/customWorldSceneNpcPrompts.ts`:自定义世界场景 NPC prompt。
3. `server-node/src/prompts/questPrompts.ts`:任务意图识别 prompt。
4. `server-node/src/prompts/runtimeItemPrompts.ts`:运行时物品意图识别 prompt。
5. `server-node/src/prompts/customWorldOrchestratorPrompts.ts`:旧 Custom World JSON 生成与修复 prompt。
6. `src/services/ai.ts``src/prompts/customWorldPrompts.ts` 中仍由前端承载的 AI orchestration / prompt 编排。
## 4. 工程防线
1. 根目录 `package.json` 中的 `server-node:*` 脚本统一改为冻结失败入口。
2. 新增 `npm run check:server-node-freeze`,用于阻止新增 `server-node` 引用。
3. 新增 `scripts/server-node-frozen.mjs`,任何旧 `server-node:*` 入口被误执行时都会直接失败并提示迁移到 `server-rs/`
4. 新增 `scripts/server-node-freeze-baseline.json`,只允许冻结前已经存在的引用继续作为迁移基线存在。
## 5. 后续处理顺序
1. 优先迁移或废弃提示词资产与 prompt 工作流。
2. 确认前端不再通过任何路径调用 Node 后端能力。
3. 删除旧脚本、旧 smoke、旧 manifest 与 `server-node/` 目录。
4. 删除冻结基线检查中对历史引用的豁免。

View File

@@ -0,0 +1,35 @@
# 平台首页响应式布局优化设计
更新时间:`2026-04-24`
## 1. 问题结论
当前平台首页桌面端视觉方向成立但移动端存在明显横向溢出Hero 右侧按钮、底部导航末项和部分卡片会被裁切。问题根因不是数据逻辑,而是桌面式固定宽度、外层 padding 与若干卡片最小宽度在窄屏下叠加,超过了 `100vw`
## 2. 本次目标
- 移动端优先保证首页不横向滚动、不裁切底部导航。
- Hero 在手机宽度下改为紧凑单列,标题、按钮和标签都完整显示。
- 桌面端降低外框视觉噪声,让主内容和 CTA 更清晰。
- 空状态区域收敛高度,避免首屏出现大面积空白。
## 3. 编码落点
- `src/components/rpg-runtime-shell/RpgRuntimeStageRouter.tsx`
- 平台壳移动端使用更小边距,避免根容器加宽。
- `src/components/rpg-entry/RpgEntryHomeView.tsx`
- 移动端根节点显式 `min-w-0``overflow-hidden`
- 底部导航外层不再额外制造宽度。
- Hero/内容卡片补充 `min-w-0`,窄屏内按容器收缩。
- `src/index.css`
- 全局与平台壳禁止横向溢出。
- 移动端压缩底部导航间距、字号和图标壳尺寸。
- 移动端收敛 `platform-page-stage` 圆角与边框层级。
- 桌面端保留卡片质感,但弱化多层外框阴影。
## 4. 验收标准
- `390px` 宽度截图中首页内容、Hero 按钮和底部四个导航项完整可见。
- 桌面端首页仍保持顶部栏、侧边导航、主推荐区和右侧趋势区结构。
- 页面不新增功能说明类 UI 文案。
- 修改中文文件后通过编码检查。

View File

@@ -1,4 +1,4 @@
# UI 改动记录(供后续 Agent 阅读)
# UI 改动记录(供后续 Agent 阅读)
本文档汇总 **像素 RPG UI 皮肤化** 相关实现与决策,便于新会话快速接手。更细的命名与规范见同目录上一级的 **`UI_CODING_STANDARD.md`**。
@@ -172,4 +172,31 @@
---
## 14. 2026-04-24 Agent 工作区恢复指针按用户隔离
- `custom-world agent session` 现在由 `server-rs` Axum 路由接入 SpacetimeDB procedure模块内按 `owner_user_id + session_id` 查询;前端恢复旧工作区前必须确认本地指针属于当前登录用户,否则旧账号残留会先请求一次 `/api/runtime/custom-world/agent/sessions/:sessionId` 并产生 404。
- `src/services/customWorldAgentUiState.ts` 的 URL 仍只保留 `customWorldSessionId` / `customWorldOperationId`,用户归属只写入 `sessionStorage`,避免把 `userId` 暴露到可分享链接里。
- `src/components/rpg-entry/useRpgCreationSessionController.ts` 在恢复初始工作区时会对比 `ownerUserId`,发现不是当前用户就清空恢复指针并停留在创作入口,不再打后端失效 session。
- 后续新增 Agent 类恢复入口时,同样要区分“可分享的 URL 指针”和“仅本机使用的登录用户归属”,不要只凭 sessionId 自动恢复受保护资源。
---
## 15. 2026-04-24 多玩法 Agent 聊天顶部文案统一隐藏
- `CreationAgentWorkspace` 已支持在 `title``assistantSummary` 为空时只展示返回、主操作、进度与锚点区域;各玩法适配层不要再传入“世界共创 / 玩法共创”这类模块标题或引导副文案。
- `custom-world``big-fish``puzzle` 三条 Agent 聊天工作区现在统一隐藏顶部标题与标题下方说明,避免只有 RPG / 自定义世界生效、其他玩法模板仍残留旧文案。
- 后续新增玩法模板时,聊天页顶部模块应保持清爽:必要状态放进进度、操作横幅或聊天消息,不把功能说明类文案默认写入 UI。
---
## 16. 2026-04-24 创作结果页亮色主题细节补色
- RPG / 拼图 / 大鱼结果页根容器统一挂 `platform-remap-surface`,让亮色主题能接管遗留的 `text-white``text-zinc-*``bg-white/*``bg-black/*` 和状态色工具类。
- 拼图与大鱼结果页顶部 Hero 只增加 `platform-result-hero` 语义类,不改变整体布局;亮色主题下由 `src/index.css` 统一换成暖白底、轻粉高光和平台主按钮色。
- 地图弹窗新增 `map-modal-overlay``map-modal-shell``map-modal-backdrop``map-modal-shade``map-info-panel` 语义类;亮色主题通过这些类降低暗色遮罩、提亮地图背景、统一节点卡与连线颜色。
- 结果页中保存、生成、发布等旧的 `bg-amber-600` / `bg-cyan-600` / `bg-cyan-200` 按钮,在 `platform-remap-surface` 内被映射回 `platform-button--primary` 同款渐变,避免亮色主题下按钮体系割裂。
- 后续继续做结果页 UI 细节时,优先补语义 class + `src/index.css` 的 light remap不要在每个结果页组件里复制一套亮色配色也不要调整页面整体布局结构。
---
_文档目的交接给下一个 Agent 时,优先读本文件 + `UI_CODING_STANDARD.md`,再改 `uiAssets.ts` / `App.tsx` / `index.css`。_

View File

@@ -152,12 +152,11 @@
开发态本地链路补充约定:
1. 浏览器仍只请求同源 `/api/runtime/big-fish/*`
2. `vite -> server-node:8081` 保持不变,由 `server-node` 先复用现有登录态完成 Bearer 校验
3. `server-node` 作为 Big Fish 兼容网关,把“已校验用户身份 + 原始请求体”转发到 Rust `api-server`
4. Rust `api-server` 继续作为 Big Fish 真相后端,正式处理会话、草稿、资产动作和运行态规则
2. `vite -> Rust api-server:3100` 是默认开发链路,禁止把新运行态接口继续接回 `server-node`
3. Rust `api-server` 作为 Big Fish 真相后端,正式处理鉴权、会话、草稿、资产动作和运行态规则
4. 若本机端口不同,只能通过 `RUST_SERVER_TARGET``GENARRATIVE_API_TARGET``GENARRATIVE_RUNTIME_SERVER_TARGET` 显式覆盖 Vite 代理目标
5. 本地默认端口:
- `vite`: `3000`
- `server-node`: `8081`
- Rust `api-server`: `3100`
- `SpacetimeDB standalone`: `3001`
6. `GENARRATIVE_SPACETIME_DATABASE` 本地开发优先跟随仓库根目录 `spacetime.local.json``database` 字段,避免 `api-server` 默认连到错误数据库名。
@@ -192,6 +191,12 @@
2. `GET /api/runtime/big-fish/runs/{runId}`
3. `POST /api/runtime/big-fish/runs/{runId}/input`
### 6.3 作品列表
1. `GET /api/runtime/big-fish/works`
开发态 Vite 必须把该同源接口代理到 Rust `api-server`;前端作品页只调用同源 `/api/runtime/big-fish/works`,不得直连 Rust 端口或回退到 `server-node`
`input` 请求体:
```json

View File

@@ -0,0 +1,66 @@
# 创作模板 Agent 聊天共用化设计2026-04-24
## 背景
当前创作模板的 Agent 聊天链路不一致RPG 世界共创与拼图共创已经由后端调用模型推理生成回复和锚点状态,大鱼吃小鱼仍在 SpacetimeDB 过程内用规则推断锚点并返回固定回复。这样会导致同一入口下不同模板的共创体验不一致,也会让后续新增模板重复实现聊天流程。
## 目标
1. 所有创作模板的 Agent 聊天都必须由后端模型推理生成回复与下一轮锚点状态。
2. Agent 聊天能力对齐 RPG 世界共创的功能效果:后端负责模型调用、锚点更新、进度推进与落库,前端只消费 session snapshot。
3. 不同模板在 Agent 聊天环节只允许通过“锚点问题配置”体现差异其余提示词骨架、流式回复、JSON 解析、失败兜底流程复用。
4. 锚点配置必须从代码逻辑中抽离为独立配置文件,新增模板时优先新增配置而不是复制聊天代码。
## 首版落地范围
| 模板 | 现状 | 本次处理 |
| --- | --- | --- |
| RPG 世界共创 | 已走模型推理,八锚点结构最完整 | 保持现有流程,作为统一体验标杆 |
| 拼图共创 | 已走模型推理,但锚点问题硬编码在 Rust 提示词中 | 把 5 个锚点问题迁入配置文件,提示词读取配置 |
| 大鱼吃小鱼 | 规则推断 + 固定回复 | 新增模型推理 turn读取 4 个锚点配置,提交消息后再 finalize 落库 |
## 配置设计
配置文件路径固定为:`server-rs/crates/api-server/src/creation_agent_anchor_templates.json`
每个模板配置包含:
- `templateId`:模板唯一标识。
- `displayName`:用于后端提示词,不直接展示在 UI。
- `creationGoal`:模板最终要收束出的可玩结果。
- `anchorQuestions`:锚点问题列表,包含 `key / label / question / requiredEffect`
首版配置只存“问题与效果”,不存模型输出 schema。原因是各模板 session 的锚点结构不同schema 仍由各自 domain 类型约束,避免为了统一而牺牲类型安全。
## 共用聊天骨架
后端新增 `creation_agent_anchor_templates` 模块,提供:
1. 读取并缓存配置文件。
2.`templateId` 返回模板配置。
3. 渲染统一的“锚点问题段落”。
各模板 agent turn 共用以下模型推理约束:
1. 系统提示词说明当前模板目标。
2. 插入配置文件中的锚点问题段落。
3. 插入当前锚点状态与最近聊天记录。
4. 要求模型只输出 JSON。
5. 流式过程中只把 `replyText` 增量给前端。
6. 完整响应解析后,由模板自身 domain 类型反序列化并落库。
## 大鱼吃小鱼落库调整
SpacetimeDB module 仍保持数据真相源职责,但不再在 `submit_big_fish_message` 内生成 assistant 回复与新锚点。流程调整为:
1. `submit_big_fish_message` 只写入用户消息,保留原锚点与进度。
2. api-server 调用模型生成 `replyText / progressPercent / nextAnchorPack`
3. 新增 `finalize_big_fish_agent_message_turn` procedure把模型结果写回 assistant 消息、锚点、进度与 `last_assistant_reply`
4. 模型失败时通过 finalize 记录失败提示,避免用户消息丢失。
## 约束
- 前端不新增逻辑分支,不在 UI 中展示规则说明类文本。
- 后端 prompt、配置与 Rust 代码必须保留中文注释或中文语义说明。
- 配置文件是后端资产,不依赖前端动态编辑。
- 若未来模板锚点结构统一,可以再把输出 schema 迁入配置;首版不做过度抽象。

View File

@@ -73,3 +73,24 @@ RPG 创作结果页已经能看到完整草稿内容,但页面底部仍然持
3. “发布并进入世界”在 blocker 清空后恢复可点击。
4. `ensure_minimal_draft_profile(...)` 生成的兜底草稿也包含 `sceneChapterBlueprints`
5. 新增 Rust 单测,覆盖“当前 Agent 结果 schema 不应再误报 blocker”与“最小草稿必须保留 `sceneChapterBlueprints` 默认槽位”。
## 5. 亮色主题阻断项弹窗配色修复
日期:`2026-04-24`
### 5.1 问题现象
点击“发布并进入世界”但仍存在阻断项时,`PublishBlockersDialog` 会通过 portal 挂载到 `document.body`。在亮色主题下,弹窗面板使用平台浅色面板变量,但标题、分隔线和阻断项标签仍混用暗色主题下的 `text-white``border-white/10``text-amber-100/78` 等硬编码类名,导致局部对比度和色相不一致。
### 5.2 修复口径
1. portal 根节点显式补上 `platform-theme platform-theme--${platformTheme}`,避免弹窗脱离原页面主题变量继承。
2. 弹窗标题、上下分隔线统一改为 `--platform-text-strong``--platform-subpanel-border`
3. 阻断项卡片复用 `platform-banner platform-banner--warning`,由平台主题变量决定亮色和暗色下的边框、背景与警示文字色。
4. 阻断项正文保持 `--platform-text-strong`,保证亮色主题下可读性,不再依赖暗色主题的琥珀色文本。
### 5.3 验收标准
1. 亮色主题下阻断项弹窗标题、正文、分隔线和按钮均保持平台浅色视觉体系。
2. 阻断项卡片呈现柔和警示底色,不出现白字或过浅琥珀字落在浅底上的情况。
3. 暗色主题下弹窗仍保持原有平台暗色 warning banner 风格。

View File

@@ -0,0 +1,85 @@
# Custom World Agent 删除作品 / 新增 NPC / 新增场景 Rust 迁移记录
日期:`2026-04-24`
## 范围
本次继续检查 RPG 创作 Agent 从旧 `server-node` 迁到 `server-rs` 后的功能缺口,重点覆盖:
1. 删除作品。
2. 新增 NPC`generate_characters`)。
3. 新增场景 / 地点(`generate_landmarks`)。
## 结论
### 删除作品
Rust 链路已经存在:
```text
DELETE /api/runtime/custom-world/library/:profileId
-> api-server.delete_custom_world_library_profile
-> spacetime-client.delete_custom_world_profile
-> SpacetimeDB delete_custom_world_profile_and_return
-> owner-only 软删除 profile并从 gallery 读模型移除
```
本次未改删除作品实现,只确认它已走 Rust + SpacetimeDB不再依赖 Node。
### 新增 NPC / 新增场景
迁移前,`spacetime-module``generate_characters``generate_landmarks` 只走 `execute_placeholder_custom_world_action(...)`,不会真的调用 AI也不会更新 `draftProfile` / draft card。
本次迁移后链路变为:
```text
前端 action
-> api-server execute_custom_world_agent_action
-> api-server 读取 session snapshot
-> platform-llm 使用旧 Node prompt 生成 JSON 数组
-> payload 注入 generatedCharacters / generatedLandmarks
-> spacetime-client.execute_custom_world_agent_action
-> SpacetimeDB 更新 draftProfile
-> SpacetimeDB upsert 对应 draft card
-> SpacetimeDB 更新 publishGate / resultPreview / checkpoint / operation / action result message
```
## Node 对齐点
新增 NPC 保留旧 Node 的 system prompt 与 user prompt 字段约束:
```text
name, role, publicMask, hiddenHook, relationToPlayer, summary, threadIds
```
新增场景保留旧 Node 的 system prompt 与 user prompt 字段约束:
```text
name, purpose, mood, dangerLevel, secret, summary, threadIds, characterIds
```
Rust 侧只做最小归一化:补 `id`、去除重名、限制数量 `1..=3`,不改写提示词原文语义。
## 落库设计
1. `generate_characters` 默认追加到 `draftProfile.storyNpcs`
2. `generate_landmarks` 追加到 `draftProfile.landmarks`
3. 每个新增对象都会生成 / 更新一张 `custom_world_draft_card`
4. 操作完成后同步更新:
- `last_assistant_reply`
- `publish_gate_json`
- `result_preview_json`
- `checkpoints_json`
- `custom_world_agent_operation`
- `custom_world_agent_message`
## 验证
已运行:
```bash
cargo test -p api-server custom_world_agent_entities --no-default-features
cargo check -p spacetime-module
```
结果:通过。`spacetime-module` 仅保留仓库既有 glob re-export warning。

View File

@@ -0,0 +1,54 @@
# Custom World `draft_foundation` Rust/Node AI 工作流对齐记录
日期:`2026-04-24`
## 背景
本次检查发现 `server-rs` 的 RPG 档案 / 世界底稿生成只做了单次 LLM 调用:直接让模型输出完整 `draftProfile`,再做最小字段归一化。这与旧 `server-node``CustomWorldAgentFoundationDraftService.generate()` 不一致。
旧 Node 流程不是单 prompt 直出,而是分阶段生成:
```text
buildFoundationGenerationSeedText
-> buildCustomWorldFrameworkPrompt
-> generateFoundationRoleOutlineEntries(playable)
-> generateFoundationRoleOutlineEntries(story)
-> generateFoundationLandmarkSeedEntries
-> expandFoundationLandmarkNetworkEntries
-> expandFoundationRoleEntries(playable, narrative)
-> expandFoundationRoleEntries(playable, dossier)
-> expandFoundationRoleEntries(story, narrative)
-> expandFoundationRoleEntries(story, dossier)
-> buildFoundationDraftProfileFromFramework
```
## 本次落地
`server-rs/crates/api-server/src/custom_world_foundation_draft.rs` 已改为按 Node 原顺序执行多阶段 AI 生成:
1. 先从 `anchorContent / anchorPack / creatorIntent / seedText` 构造 `settingText`
2. 使用旧 Node 的 framework prompt 生成世界核心骨架。
3. 分批生成可扮演角色 outline。
4. 分批生成场景角色 outline。
5. 分批生成关键场景 seed。
6. 补全关键场景探索网络。
7. 先补可扮演角色叙事档案,再补养成档案。
8. 先补场景角色叙事档案,再补养成档案。
9. 将分阶段结果编译回 `draftProfile`,再交给 SpacetimeDB action 落库。
## 约束
1. 未修改旧 Node 提示词原文的语义与阶段顺序。
2. Rust 侧新增 prompt 构造只服务 `api-server` 外部 LLM 调用SpacetimeDB reducer 仍只负责校验与落库,不承担联网生成。
3. 当前仍保留 Rust 侧最小归一化,目的仅是保证 `publish gate / result preview` 需要的字段存在,不替代 Node 的 AI 工作流。
4. 后续如继续迁移,需要优先把 Node `buildFoundationDraftProfileFromFramework` 的结构编译细节进一步完整 Rust 化,而不是回退到单 prompt 直出。
## 验证
已运行:
```bash
cargo test -p api-server custom_world_foundation_draft --no-default-features
```
结果:`3 passed`

View File

@@ -0,0 +1,40 @@
# 世界结果页新增场景与 NPC 生成修复
## 背景
世界结果页在 Agent 草稿模式下点击“新增场景角色”和“新增场景”时,会走 `api-server``generate_characters / generate_landmarks` 动作:
1. `api-server` 根据当前 `draft_profile` 请求 LLM 生成新增实体。
2. `spacetime-module``generatedCharacters / generatedLandmarks` 写回 `draft_profile`
3. 结果页从服务端 `resultPreview.preview` 读取最新世界 profile。
## 问题
LLM 扩展提示词为了草稿卡片简洁,只要求返回角色的 `publicMask / hiddenHook / relationToPlayer / summary`,以及场景的 `purpose / mood / secret / summary / characterIds`
但结果页与运行时 `CustomWorldProfile` 读取的是当前完整字段:
- NPC`description / backstory / personality / motivation / relationshipHooks / tags / initialAffinity`
- 场景:`description / dangerLevel / sceneNpcIds / connections`
因此新增实体即使后端动作成功,也可能因为字段缺失或关联字段名不一致,在结果页表现为“生成后没有可用内容 / 场景没有 NPC 关联”。
此外Agent 结果页生成回调原本只返回 `void`:当 `activeAgentSessionId` 失效、服务端没有返回最新 `resultPreview`,或最新 profile 没有新增实体时,前端只会结束 pending 动画,表现为“点击后闪一下就消失”。
## 修复方案
本次修复保持“前端只表现,后端负责数据整理”的边界:
1.`api-server` 生成实体归一化阶段补齐结果页需要的最小完整字段。
2. NPC 将 `publicMask / summary` 映射为 `description``hiddenHook` 映射为 `backstory / motivation``relationToPlayer` 进入 `relationshipHooks`
3. 场景将 `summary / purpose / mood / secret` 合成 `description`,将 `characterIds` 转为 `sceneNpcIds`
4. 保留 LLM 已返回的字段,不覆盖更完整的结构化结果。
5. 增加后端单元测试锁定新增 NPC 与场景的 profile 字段契约。
6. 前端 Agent 生成回调返回最新 profile如果没有可用会话或最新 profile 未增加对应实体,结果页显示明确错误,不再静默消失。
## 验收
- `generate_characters` 的 payload 中新增角色必须包含非空 `description` 与可用 `relationshipHooks`
- `generate_landmarks` 的 payload 中新增场景必须包含非空 `description`,并能把 `characterIds` 落为 `sceneNpcIds`
- 结果页继续只消费 `resultPreview.preview`,不新增前端本地编译分支。
- 结果页点击新增实体后,如果服务端没有回传新增内容,必须展示错误提示。

View File

@@ -4,6 +4,7 @@
## 文档列表
- [CUSTOM_WORLD_RESULT_ENTITY_GENERATION_FIX_2026-04-24.md](./CUSTOM_WORLD_RESULT_ENTITY_GENERATION_FIX_2026-04-24.md):记录世界结果页在 Agent 草稿模式下新增场景、新增 NPC 生成成功但结果页字段不可用的根因,并冻结 `api-server` 生成归一化层补齐 profile 字段的修复口径。
- [ADMIN_CONSOLE_SERVICE_DESIGN_2026-04-23.md](./ADMIN_CONSOLE_SERVICE_DESIGN_2026-04-23.md):冻结 Rust `api-server` 内后台管理服务首版方案,明确管理员用户名密码登录、管理员 JWT 鉴权、数据库概览、受控 API 调试台与同源管理页面的落地边界。
- [SPACETIME_MODULE_LIB_RS_SPLIT_EXECUTION_2026-04-23.md](./SPACETIME_MODULE_LIB_RS_SPLIT_EXECUTION_2026-04-23.md):冻结 `server-rs/crates/spacetime-module/src/lib.rs` 的模块地图、二级落位点与迁移顺序,要求后续 SpacetimeDB 主工程改动按对应模块落位,不再继续堆回单大文件。
- [CUSTOM_WORLD_DRAFT_FOUNDATION_API_SERVER_LLM_MIGRATION_2026-04-23.md](./CUSTOM_WORLD_DRAFT_FOUNDATION_API_SERVER_LLM_MIGRATION_2026-04-23.md):冻结 `draft_foundation` 从 SpacetimeDB 内部规则编译迁到 `api-server + platform-llm` 的边界,明确草稿必须由 `api-server` 真实调 LLM 生成SpacetimeDB 只负责落库。

View File

@@ -0,0 +1,55 @@
# RPG 创作结果页编辑功能迁移审计
日期:`2026-04-24`
## 本次发现
`generate_characters` / `generate_landmarks` 后端已经迁到 Rust但前端 Agent 结果页看不到入口,原因不是后端能力缺失,而是:
1. `RpgCreationResultViewImpl``compactAgentResultMode=true` 时隐藏 `createActionLabel / onCreateAction`
2. `PlatformEntryFlowShellImpl` 对 Agent 草稿结果页传入了 `compactAgentResultMode={isAgentDraftResultView}`
3. 结果页原有“新增可扮演角色 / 新增场景角色 / 新增场景”仍走 legacy `rpgCreationAssetClient`,只改前端内存态,不会触发 Agent action。
## 本次前端修复
已改为:
```text
Agent 结果页点击新增场景角色 / 新增场景
-> RpgCreationResultView.onGenerateEntity
-> autosaveCoordinator.executeAgentActionAndWait
-> POST /api/runtime/custom-world/agent/sessions/:sessionId/actions
-> generate_characters / generate_landmarks
-> 等 operation completed
-> 拉最新 session
-> rpgCreationPreviewAdapter.buildPreviewFromSession
-> 刷新结果页 profile
```
说明:当前可扮演角色 tab 的“新增可扮演角色”也会调用 `generate_characters`,后端现阶段会追加到 `storyNpcs`。因此严格意义上的“新增可扮演角色”仍未完整迁移,需要后续给 action 增加角色类型参数或新增 `generate_playable_characters`
## 已迁移 / 可见
1. 删除作品:已有 Rust + SpacetimeDB 软删除链路。
2. 新增场景角色:结果页可见,调用 Rust `generate_characters`
3. 新增场景 / 地点:结果页可见,调用 Rust `generate_landmarks`
4. Agent 结果页发布进入世界:已有 `publish_world` + publish gate 链路。
5. 手动编辑结果页 profile目前仍通过 `sync_result_profile` 自动保存回 Agent session。
## 尚未完整迁移的结果页编辑功能
1. 新增可扮演角色:前端有入口,但 Rust action 暂无角色类型区分,当前会落到 `storyNpcs`
2. 批量删除场景角色:前端只改本地 profile再靠 `sync_result_profile` 同步,不是独立 Rust action。
3. 批量删除场景:前端只改本地 profile再靠 `sync_result_profile` 同步,不是独立 Rust action。
4. 单个角色 / 场景的细粒度编辑:前端 modal 仍编辑本地 profile再靠 `sync_result_profile` 同步SpacetimeDB 虽有 `update_draft_card`,但结果页表单尚未按 card section action 化。
5. 角色资产生成:`generate_role_assets / sync_role_assets` Rust 侧仍是 placeholder 或外部链路未完全接入结果页。
6. 场景资产生成:`generate_scene_assets / sync_scene_assets` Rust 侧仍是 placeholder 或外部链路未完全接入结果页。
7. 长尾补全:`expand_long_tail` Rust 侧仍是 placeholder。
8. 回滚 checkpointRust 有 `revert_checkpoint`,但结果页没有清晰可见入口。
## 下一步建议
1.`generate_characters` 增加 `roleType: playable|story` 契约,并让可扮演角色 tab 真正落到 `playableNpcs`
2. 将删除角色 / 删除场景改为独立 action避免继续依赖整份 profile 同步。
3. 将角色 / 场景编辑 modal 的保存改为 `update_draft_card` 或更细粒度 reducer而不是每次整份 profile 覆盖。
4. 继续迁移 `generate_role_assets / generate_scene_assets / expand_long_tail`,并在结果页显示对应入口。

View File

@@ -50,9 +50,10 @@ src/services/creation-agent/
聊天页展示规则:
1. Agent 聊天页不展示锚点内容卡片,锚点只作为进度与后端生成依据。
2. 生成草稿 / 生成结果页主按钮只在 `progressPercent` 归一化后达到 `100%` 时显示
3. 进度条下方承载“总结当前设定”“补全剩余设定”等进度操作按钮
4. “补全剩余设定”必须配置 `minTurn: 2`,对话不足两轮时不显示
2. 标题区文案支持按品类留空;当 `title``assistantSummary` 都为空时,顶部模块只保留返回、进度和操作按钮,不显示额外标题与副文案
3. 生成草稿 / 生成结果页主按钮只在 `progressPercent` 归一化后达到 `100%` 时显示
4. 进度条下方承载“总结当前设定”“补全剩余设定”等进度操作按钮
5. “补全剩余设定”必须配置 `minTurn: 2`,对话不足两轮时不显示。
组件内部只做表现,不读取任何 RPG、Big Fish、Puzzle 专属字段。

View File

@@ -12,15 +12,15 @@
"deploy:rust:remote": "node scripts/run-bash-script.mjs scripts/deploy-rust-remote.sh",
"build:rust:ubuntu": "node scripts/run-bash-script.mjs scripts/deploy-rust-remote.sh",
"serve:caddy": "node scripts/run-caddy-dev.mjs",
"server-node:dev": "npm --prefix server-node run dev",
"server-node:build": "npm --prefix server-node run build",
"server-node:db:migrate": "npm --prefix server-node run db:migrate",
"server-node:manifest:backend": "npm --prefix server-node run manifest:backend",
"server-node:test": "npm --prefix server-node run test",
"server-node:test:baseline": "npx tsx --test server-node/src/observability.test.ts",
"server-node:smoke": "npx tsx scripts/smoke-server-node.ts",
"server-node:smoke:proxy": "npx tsx scripts/smoke-same-origin-stack.ts",
"server-node:check:deploy": "npm run check:encoding && npm run server-node:test && npm run server-node:smoke && npm run server-node:build && npm run build && npm run server-node:smoke:proxy",
"server-node:dev": "node scripts/server-node-frozen.mjs",
"server-node:build": "node scripts/server-node-frozen.mjs",
"server-node:db:migrate": "node scripts/server-node-frozen.mjs",
"server-node:manifest:backend": "node scripts/server-node-frozen.mjs",
"server-node:test": "node scripts/server-node-frozen.mjs",
"server-node:test:baseline": "node scripts/server-node-frozen.mjs",
"server-node:smoke": "node scripts/server-node-frozen.mjs",
"server-node:smoke:proxy": "node scripts/server-node-frozen.mjs",
"server-node:check:deploy": "node scripts/server-node-frozen.mjs",
"server-rs:m7:preflight": "powershell -ExecutionPolicy Bypass -File server-rs/scripts/m7-preflight.ps1",
"m7:api-compare": "node scripts/run-tsx.cjs scripts/m7-api-compare.ts",
"build": "node scripts/build-gate.mjs",
@@ -32,7 +32,7 @@
"lint:guardrails": "npm run lint:eslint",
"typecheck": "tsc -p tsconfig.typecheck-guardrails.json --noEmit",
"typecheck:guardrails": "npm run typecheck",
"lint": "npm run check:encoding && npm run lint:eslint && npm run typecheck",
"lint": "npm run check:encoding && npm run check:server-node-freeze && npm run lint:eslint && npm run typecheck",
"lint:fix": "eslint . --ext .ts,.tsx,.js,.mjs,.cjs --fix && prettier --write .",
"format": "prettier --write .",
"format:check": "prettier --check .",
@@ -42,7 +42,8 @@
"check:data": "node scripts/run-tsx.cjs scripts/validate-content.ts",
"check:overrides": "node scripts/run-tsx.cjs scripts/validate-overrides.ts",
"check:smoke": "node scripts/run-tsx.cjs scripts/smoke-content.ts",
"check:content": "npm run check:data && npm run check:overrides && npm run check:smoke"
"check:content": "npm run check:data && npm run check:overrides && npm run check:smoke",
"check:server-node-freeze": "node scripts/check-server-node-freeze.mjs"
},
"dependencies": {
"@tailwindcss/vite": "^4.1.14",

View File

@@ -26,6 +26,8 @@ export type RpgAgentActionType =
| 'sync_result_profile'
| 'generate_characters'
| 'generate_landmarks'
| 'delete_characters'
| 'delete_landmarks'
| 'generate_role_assets'
| 'sync_role_assets'
| 'generate_scene_assets'
@@ -83,6 +85,7 @@ export type RpgAgentActionRequest =
| {
action: 'generate_characters';
count: number;
roleType?: 'playable' | 'story' | null;
promptText?: string | null;
anchorCardIds?: string[];
}
@@ -92,6 +95,8 @@ export type RpgAgentActionRequest =
promptText?: string | null;
anchorCardIds?: string[];
}
| { action: 'delete_characters'; roleIds: string[] }
| { action: 'delete_landmarks'; sceneIds: string[] }
| { action: 'generate_role_assets'; roleIds: string[] }
| {
action: 'sync_role_assets';
@@ -101,7 +106,11 @@ export type RpgAgentActionRequest =
generatedAnimationSetId?: string | null;
animationMap?: Record<string, unknown> | null;
}
| { action: 'generate_scene_assets'; sceneIds: string[] }
| {
action: 'generate_scene_assets';
sceneIds: string[];
sceneKind?: 'camp' | 'landmark' | null;
}
| {
action: 'sync_scene_assets';
sceneId: string;

View File

@@ -0,0 +1,127 @@
#!/usr/bin/env node
import { createHash } from 'node:crypto';
import { existsSync, readdirSync, readFileSync } from 'node:fs';
import path from 'node:path';
import { fileURLToPath } from 'node:url';
const repoRoot = path.resolve(path.dirname(fileURLToPath(import.meta.url)), '..');
const baselinePath = path.join(repoRoot, 'scripts', 'server-node-freeze-baseline.json');
const needle = 'server-node';
const ignoredDirectories = new Set([
'.git',
'.codex',
'.codex-temp',
'.idea',
'node_modules',
'dist',
'build',
'coverage',
'target',
'logs',
]);
const ignoredFiles = new Set([
'scripts/check-server-node-freeze.mjs',
'scripts/server-node-freeze-baseline.json',
'scripts/server-node-frozen.mjs',
'docs/audits/engineering/SERVER_NODE_FREEZE_AND_DEPRECATION_2026-04-24.md',
]);
const allowedExtensions = new Set([
'.cjs',
'.js',
'.json',
'.md',
'.mjs',
'.ps1',
'.rs',
'.toml',
'.ts',
'.tsx',
'.yaml',
'.yml',
]);
function toRepoPath(absolutePath) {
return path.relative(repoRoot, absolutePath).replaceAll(path.sep, '/');
}
function hashLine(line) {
return createHash('sha256').update(line.trim()).digest('hex');
}
function walk(directory, output) {
for (const entry of readdirSync(directory, { withFileTypes: true })) {
if (entry.isDirectory()) {
if (!ignoredDirectories.has(entry.name)) {
walk(path.join(directory, entry.name), output);
}
continue;
}
const absolutePath = path.join(directory, entry.name);
const repoPath = toRepoPath(absolutePath);
if (ignoredFiles.has(repoPath)) {
continue;
}
if (!allowedExtensions.has(path.extname(entry.name).toLowerCase())) {
continue;
}
output.push(absolutePath);
}
}
function collectReferences() {
const files = [];
walk(repoRoot, files);
const references = new Map();
for (const file of files) {
const repoPath = toRepoPath(file);
const content = readFileSync(file, 'utf8');
const lines = content.split(/\r?\n/u);
for (const line of lines) {
if (!line.toLowerCase().includes(needle)) {
continue;
}
const key = `${repoPath}\u0000${hashLine(line)}`;
references.set(key, (references.get(key) || 0) + 1);
}
}
return references;
}
function parseBaseline() {
if (!existsSync(baselinePath)) {
return new Map();
}
const baseline = JSON.parse(readFileSync(baselinePath, 'utf8'));
return new Map(Object.entries(baseline.references || {}));
}
const currentReferences = collectReferences();
const baselineReferences = parseBaseline();
const newReferences = [];
for (const [key, count] of currentReferences.entries()) {
const allowedCount = baselineReferences.get(key) || 0;
if (count > allowedCount) {
const [repoPath] = key.split('\u0000');
newReferences.push({ repoPath, count: count - allowedCount });
}
}
if (newReferences.length > 0) {
console.error('检测到冻结后新增的 server-node 引用,请迁移到 server-rs 或更新废弃审计后再处理:');
for (const reference of newReferences.slice(0, 50)) {
console.error(`- ${reference.repoPath} (+${reference.count})`);
}
if (newReferences.length > 50) {
console.error(`... 另有 ${newReferences.length - 50}`);
}
process.exit(1);
}
console.log('server-node freeze guard passed: 未发现冻结后新增引用。');

File diff suppressed because it is too large Load Diff

View File

@@ -0,0 +1,8 @@
#!/usr/bin/env node
const command = process.env.npm_lifecycle_event || 'server-node:*';
console.error(`[server-node frozen] ${command} 已冻结。`);
console.error('后端主线已切换到 server-rsRust + SpacetimeDB禁止继续运行或扩展 server-node。');
console.error('如需开发后端能力,请使用 npm run dev:rust 或 server-rs/scripts/*。');
process.exit(1);

View File

@@ -1 +0,0 @@

View File

@@ -1 +0,0 @@

View File

@@ -37,6 +37,10 @@ use spacetime_client::{
};
use tokio::time::sleep;
use crate::big_fish_agent_turn::{
BigFishAgentTurnRequest, build_failed_finalize_record_input, build_finalize_record_input,
run_big_fish_agent_turn,
};
use crate::{
api_response::json_success_body, auth::AuthenticatedAccessToken, http_error::AppError,
request_context::RequestContext, state::AppState,
@@ -157,11 +161,12 @@ pub async fn submit_big_fish_message(
));
}
let session = state
let owner_user_id = authenticated.claims().user_id().to_string();
let submitted_session = state
.spacetime_client()
.submit_big_fish_message(BigFishMessageSubmitRecordInput {
session_id,
owner_user_id: authenticated.claims().user_id().to_string(),
session_id: session_id.clone(),
owner_user_id: owner_user_id.clone(),
user_message_id: client_message_id,
user_message_text: message_text,
assistant_message_id: build_prefixed_uuid_id("big-fish-message-"),
@@ -171,6 +176,37 @@ pub async fn submit_big_fish_message(
.map_err(|error| {
big_fish_error_response(&request_context, map_big_fish_client_error(error))
})?;
let turn_result = run_big_fish_agent_turn(
BigFishAgentTurnRequest {
llm_client: state.llm_client(),
session: &submitted_session,
},
|_| {},
)
.await;
let finalize_input = match turn_result {
Ok(turn_result) => build_finalize_record_input(
session_id.clone(),
owner_user_id.clone(),
build_prefixed_uuid_id("big-fish-message-"),
turn_result,
current_utc_micros(),
),
Err(error) => build_failed_finalize_record_input(
session_id.clone(),
owner_user_id.clone(),
&submitted_session,
error.to_string(),
current_utc_micros(),
),
};
let session = state
.spacetime_client()
.finalize_big_fish_agent_message(finalize_input)
.await
.map_err(|error| {
big_fish_error_response(&request_context, map_big_fish_client_error(error))
})?;
Ok(json_success_body(
Some(&request_context),
@@ -198,14 +234,23 @@ pub async fn stream_big_fish_message(
})?;
ensure_non_empty(&request_context, &session_id, "sessionId")?;
let client_message_id = payload.client_message_id.trim().to_string();
let message_text = payload.text.trim().to_string();
if client_message_id.is_empty() || message_text.is_empty() {
return Err(big_fish_bad_request(
&request_context,
"clientMessageId and text are required",
));
}
let owner_user_id = authenticated.claims().user_id().to_string();
let session = state
let submitted_session = state
.spacetime_client()
.submit_big_fish_message(BigFishMessageSubmitRecordInput {
session_id,
owner_user_id,
user_message_id: payload.client_message_id.trim().to_string(),
user_message_text: payload.text.trim().to_string(),
session_id: session_id.clone(),
owner_user_id: owner_user_id.clone(),
user_message_id: client_message_id,
user_message_text: message_text,
assistant_message_id: build_prefixed_uuid_id("big-fish-message-"),
submitted_at_micros: current_utc_micros(),
})
@@ -213,18 +258,52 @@ pub async fn stream_big_fish_message(
.map_err(|error| {
big_fish_error_response(&request_context, map_big_fish_client_error(error))
})?;
let mut streamed_reply_text = String::new();
let turn_result = run_big_fish_agent_turn(
BigFishAgentTurnRequest {
llm_client: state.llm_client(),
session: &submitted_session,
},
|text| {
streamed_reply_text = text.to_string();
},
)
.await;
let reply_text = match &turn_result {
Ok(result) => result.assistant_reply_text.clone(),
Err(error) => error.to_string(),
};
let finalize_input = match turn_result {
Ok(turn_result) => build_finalize_record_input(
session_id.clone(),
owner_user_id.clone(),
build_prefixed_uuid_id("big-fish-message-"),
turn_result,
current_utc_micros(),
),
Err(error) => build_failed_finalize_record_input(
session_id.clone(),
owner_user_id.clone(),
&submitted_session,
error.to_string(),
current_utc_micros(),
),
};
let session = state
.spacetime_client()
.finalize_big_fish_agent_message(finalize_input)
.await
.map_err(|error| {
big_fish_error_response(&request_context, map_big_fish_client_error(error))
})?;
let session_response = map_big_fish_session_response(session);
let reply_text = session_response
.last_assistant_reply
.clone()
.unwrap_or_else(|| "锚点已更新。".to_string());
let mut sse_body = String::new();
append_sse_event(
&request_context,
&mut sse_body,
"reply_delta",
&json!({ "text": reply_text }),
&json!({ "text": if streamed_reply_text.is_empty() { reply_text } else { streamed_reply_text } }),
)?;
append_sse_event(
&request_context,

View File

@@ -0,0 +1,312 @@
use module_big_fish::{BigFishAnchorPack, BigFishCreationStage};
use platform_llm::{LlmClient, LlmMessage, LlmStreamDelta, LlmTextRequest};
use serde::{Deserialize, Serialize};
use serde_json::{Value as JsonValue, json};
use spacetime_client::{
BigFishAgentMessageRecord, BigFishMessageFinalizeRecordInput, BigFishSessionRecord,
};
use crate::creation_agent_anchor_templates::{
get_creation_agent_anchor_template, render_anchor_question_block,
};
#[derive(Clone, Debug)]
pub(crate) struct BigFishAgentTurnRequest<'a> {
pub llm_client: Option<&'a LlmClient>,
pub session: &'a BigFishSessionRecord,
}
#[derive(Clone, Debug)]
pub(crate) struct BigFishAgentTurnResult {
pub assistant_reply_text: String,
pub stage: String,
pub progress_percent: u32,
pub anchor_pack_json: String,
pub error_message: Option<String>,
}
#[derive(Clone, Debug)]
pub(crate) struct BigFishAgentTurnError {
message: String,
}
impl BigFishAgentTurnError {
fn new(message: impl Into<String>) -> Self {
Self {
message: message.into(),
}
}
}
impl std::fmt::Display for BigFishAgentTurnError {
fn fmt(&self, formatter: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
formatter.write_str(&self.message)
}
}
impl std::error::Error for BigFishAgentTurnError {}
#[derive(Clone, Debug, Serialize, Deserialize)]
#[serde(rename_all = "camelCase")]
struct BigFishAgentModelOutput {
reply_text: String,
progress_percent: u32,
next_anchor_pack: BigFishAnchorPack,
}
const BIG_FISH_AGENT_SYSTEM_PROMPT: &str = r#"你是一个负责和创作者共创“大鱼吃小鱼”竖屏玩法的中文创意策划。
你必须把用户灵感收束成可以编译为可玩草稿的玩法、生态视觉、成长阶梯和风险节奏。
你必须同时输出:
1. 一段直接发给用户的中文回复 replyText
2. 当前进度 progressPercent
3. 下一轮完整可用的 nextAnchorPack
硬约束:
1. 只能输出 JSON不能输出代码块或解释
2. nextAnchorPack 必须是完整对象,不能只输出 patch
3. replyText 必须是自然中文不能提“字段”“锚点”“结构”“JSON”等内部词
4. replyText 一次最多推进一个最关键问题
5. 必须对齐 RPG 共创的体验:先理解玩家幻想,再收束成能进入运行时的可玩效果
6. progressPercent 范围只能是 0 到 100
7. status 只能使用 missing / inferred / confirmed / locked
"#;
const BIG_FISH_AGENT_OUTPUT_CONTRACT: &str = r#"请严格按以下 JSON 输出,不要输出其他文字:
{
"replyText": "",
"progressPercent": 0,
"nextAnchorPack": {
"gameplayPromise": {
"key": "gameplayPromise",
"label": "玩法承诺",
"value": "",
"status": "missing"
},
"ecologyVisualTheme": {
"key": "ecologyVisualTheme",
"label": "生态视觉主题",
"value": "",
"status": "missing"
},
"growthLadder": {
"key": "growthLadder",
"label": "成长阶梯",
"value": "",
"status": "missing"
},
"riskTempo": {
"key": "riskTempo",
"label": "风险节奏",
"value": "",
"status": "missing"
}
}
}"#;
pub(crate) async fn run_big_fish_agent_turn<F>(
request: BigFishAgentTurnRequest<'_>,
mut on_reply_update: F,
) -> Result<BigFishAgentTurnResult, BigFishAgentTurnError>
where
F: FnMut(&str),
{
let llm_client = request
.llm_client
.ok_or_else(|| BigFishAgentTurnError::new("当前模型不可用,请稍后重试。"))?;
let prompt = build_big_fish_agent_prompt(request.session);
let mut latest_reply_text = String::new();
let response = llm_client
.stream_text(
LlmTextRequest::new(vec![
LlmMessage::system(format!("{BIG_FISH_AGENT_SYSTEM_PROMPT}\n\n{prompt}")),
LlmMessage::user("请按约定输出这一轮的 JSON。"),
]),
|delta: &LlmStreamDelta| {
if let Some(reply_progress) =
extract_reply_text_from_partial_json(delta.accumulated_text.as_str())
&& reply_progress != latest_reply_text
{
latest_reply_text = reply_progress.clone();
on_reply_update(reply_progress.as_str());
}
},
)
.await
.map_err(|_| BigFishAgentTurnError::new("大鱼吃小鱼聊天生成失败,请稍后重试。"))?;
let parsed = parse_json_response_text(response.content.as_str())
.map_err(|_| BigFishAgentTurnError::new("大鱼吃小鱼聊天结果解析失败,请稍后重试。"))?;
let output = parse_big_fish_model_output(&parsed)?;
if output.reply_text != latest_reply_text {
on_reply_update(output.reply_text.as_str());
}
Ok(BigFishAgentTurnResult {
assistant_reply_text: output.reply_text,
stage: BigFishCreationStage::CollectingAnchors.as_str().to_string(),
progress_percent: output.progress_percent.min(100),
anchor_pack_json: serde_json::to_string(&output.next_anchor_pack)
.unwrap_or_else(|_| "{}".to_string()),
error_message: None,
})
}
pub(crate) fn build_finalize_record_input(
session_id: String,
owner_user_id: String,
assistant_message_id: String,
result: BigFishAgentTurnResult,
updated_at_micros: i64,
) -> BigFishMessageFinalizeRecordInput {
BigFishMessageFinalizeRecordInput {
session_id,
owner_user_id,
assistant_message_id: Some(assistant_message_id),
assistant_reply_text: Some(result.assistant_reply_text),
stage: result.stage,
progress_percent: result.progress_percent,
anchor_pack_json: result.anchor_pack_json,
error_message: result.error_message,
updated_at_micros,
}
}
pub(crate) fn build_failed_finalize_record_input(
session_id: String,
owner_user_id: String,
session: &BigFishSessionRecord,
error_message: String,
updated_at_micros: i64,
) -> BigFishMessageFinalizeRecordInput {
BigFishMessageFinalizeRecordInput {
session_id,
owner_user_id,
assistant_message_id: None,
assistant_reply_text: None,
stage: session.stage.clone(),
progress_percent: session.progress_percent,
anchor_pack_json: serialize_record_anchor_pack(&session.anchor_pack),
error_message: Some(error_message),
updated_at_micros,
}
}
fn build_big_fish_agent_prompt(session: &BigFishSessionRecord) -> String {
let anchor_question_block = get_creation_agent_anchor_template("big_fish")
.map(render_anchor_question_block)
.unwrap_or_else(|| "模板目标:收束成可玩的竖屏大鱼吃小鱼玩法草稿。".to_string());
format!(
"{anchor_question_block}\n\n当前是第 {turn} 轮,当前进度 {progress}% 。\n\n当前 anchor pack\n{anchor_pack}\n\n最近聊天记录:\n{chat_history}\n\n{contract}",
anchor_question_block = anchor_question_block,
turn = session.current_turn.saturating_add(1),
progress = session.progress_percent,
anchor_pack = serialize_record_anchor_pack(&session.anchor_pack),
chat_history =
serde_json::to_string_pretty(&build_chat_history(session.messages.as_slice()))
.unwrap_or_else(|_| "[]".to_string()),
contract = BIG_FISH_AGENT_OUTPUT_CONTRACT,
)
}
fn build_chat_history(messages: &[BigFishAgentMessageRecord]) -> Vec<JsonValue> {
messages
.iter()
.map(|message| {
json!({
"role": message.role,
"kind": message.kind,
"content": message.text,
})
})
.collect()
}
fn parse_big_fish_model_output(
parsed: &JsonValue,
) -> Result<BigFishAgentModelOutput, BigFishAgentTurnError> {
serde_json::from_value::<BigFishAgentModelOutput>(parsed.clone())
.map_err(|_| BigFishAgentTurnError::new("大鱼吃小鱼模型结果缺少必要内容,请稍后重试。"))
}
fn serialize_record_anchor_pack(anchor_pack: &spacetime_client::BigFishAnchorPackRecord) -> String {
serde_json::to_string_pretty(&json!({
"gameplayPromise": {
"key": anchor_pack.gameplay_promise.key,
"label": anchor_pack.gameplay_promise.label,
"value": anchor_pack.gameplay_promise.value,
"status": anchor_pack.gameplay_promise.status,
},
"ecologyVisualTheme": {
"key": anchor_pack.ecology_visual_theme.key,
"label": anchor_pack.ecology_visual_theme.label,
"value": anchor_pack.ecology_visual_theme.value,
"status": anchor_pack.ecology_visual_theme.status,
},
"growthLadder": {
"key": anchor_pack.growth_ladder.key,
"label": anchor_pack.growth_ladder.label,
"value": anchor_pack.growth_ladder.value,
"status": anchor_pack.growth_ladder.status,
},
"riskTempo": {
"key": anchor_pack.risk_tempo.key,
"label": anchor_pack.risk_tempo.label,
"value": anchor_pack.risk_tempo.value,
"status": anchor_pack.risk_tempo.status,
},
}))
.unwrap_or_else(|_| "{}".to_string())
}
fn parse_json_response_text(text: &str) -> Result<JsonValue, serde_json::Error> {
if let Ok(value) = serde_json::from_str::<JsonValue>(text) {
return Ok(value);
}
let Some(start) = text.find('{') else {
return serde_json::from_str(text);
};
let Some(end) = text.rfind('}') else {
return serde_json::from_str(text);
};
serde_json::from_str(&text[start..=end])
}
fn extract_reply_text_from_partial_json(text: &str) -> Option<String> {
let marker = "\"replyText\"";
let marker_index = text.find(marker)?;
let after_marker = &text[marker_index + marker.len()..];
let colon_index = after_marker.find(':')?;
let after_colon = after_marker[colon_index + 1..].trim_start();
let content = after_colon.strip_prefix('"')?;
let mut result = String::new();
let mut escaped = false;
for character in content.chars() {
if escaped {
result.push(match character {
'n' => '\n',
'r' => '\r',
't' => '\t',
'"' => '"',
'\\' => '\\',
other => other,
});
escaped = false;
continue;
}
if character == '\\' {
escaped = true;
continue;
}
if character == '"' {
return Some(result);
}
result.push(character);
}
if result.is_empty() {
None
} else {
Some(result)
}
}

View File

@@ -0,0 +1,127 @@
{
"templates": [
{
"templateId": "rpg_world",
"displayName": "RPG 世界共创",
"creationGoal": "收束成可直接进入 RPG 运行时的世界、角色、冲突、入口与隐藏线索。",
"anchorQuestions": [
{
"key": "worldPromise",
"label": "世界承诺",
"question": "这个世界最想让玩家体验到什么独特承诺?",
"requiredEffect": "明确世界钩子、差异化体验与玩家期待。"
},
{
"key": "playerFantasy",
"label": "玩家幻想",
"question": "玩家进入后扮演谁、追求什么、害怕失去什么?",
"requiredEffect": "明确身份、目标与核心情绪压力。"
},
{
"key": "themeBoundary",
"label": "题材边界",
"question": "题材气质、视觉方向和禁忌边界分别是什么?",
"requiredEffect": "约束语气、审美与不可越界内容。"
},
{
"key": "playerEntryPoint",
"label": "玩家入口",
"question": "玩家第一幕以什么身份遇到什么问题?",
"requiredEffect": "形成可开局的身份、问题和行动动机。"
},
{
"key": "coreConflict",
"label": "核心冲突",
"question": "表层冲突、隐藏危机和首个触发冲突是什么?",
"requiredEffect": "建立运行时持续推进的矛盾发动机。"
},
{
"key": "keyRelationships",
"label": "关键关系",
"question": "哪些人物关系最能推动选择、秘密和代价?",
"requiredEffect": "形成 NPC、势力或亲密关系的互动张力。"
},
{
"key": "hiddenLine",
"label": "隐藏线",
"question": "世界真相如何被误导、铺垫并逐步揭示?",
"requiredEffect": "为中后期探索与反转留下结构化线索。"
},
{
"key": "iconicElements",
"label": "标志元素",
"question": "哪些标志物、机构、规则或意象让世界被记住?",
"requiredEffect": "提供可复用的视觉、剧情和系统记忆点。"
}
]
},
{
"templateId": "puzzle",
"displayName": "拼图共创",
"creationGoal": "收束成可以发布为拼图关卡的视觉方案。",
"anchorQuestions": [
{
"key": "themePromise",
"label": "题材承诺",
"question": "这张拼图给玩家的题材和完成期待是什么?",
"requiredEffect": "明确拼图主题、辨识度和完成后的满足感。"
},
{
"key": "visualSubject",
"label": "画面主体",
"question": "画面中最需要被玩家一眼看懂的主体是什么?",
"requiredEffect": "明确主体、层级和可被切片识别的形状。"
},
{
"key": "visualMood",
"label": "视觉气质",
"question": "整体色彩、光线、情绪和美术风格是什么?",
"requiredEffect": "收束画面风格,避免结果图风格漂移。"
},
{
"key": "compositionHooks",
"label": "拼图记忆点",
"question": "哪些构图、纹理或局部细节会成为玩家拼接线索?",
"requiredEffect": "提供适合拼图玩法的边缘、块面和局部记忆点。"
},
{
"key": "tagsAndForbidden",
"label": "标签与禁忌",
"question": "需要保留哪些关键词,又必须避开什么内容?",
"requiredEffect": "锁定生成标签和负向约束。"
}
]
},
{
"templateId": "big_fish",
"displayName": "大鱼吃小鱼共创",
"creationGoal": "收束成可直接编译为竖屏大鱼吃小鱼玩法草稿的成长、生态、节奏方案。",
"anchorQuestions": [
{
"key": "gameplayPromise",
"label": "玩法承诺",
"question": "这版大鱼吃小鱼最核心的吞噬成长爽点是什么?",
"requiredEffect": "明确玩家为什么要持续吞噬、升级和冒险。"
},
{
"key": "ecologyVisualTheme",
"label": "生态视觉主题",
"question": "鱼群、场景和敌我生态的视觉主题是什么?",
"requiredEffect": "提供后续角色图、动作图和背景图的一致视觉方向。"
},
{
"key": "growthLadder",
"label": "成长阶梯",
"question": "从弱小到终局巨兽的 6 到 12 级成长阶梯如何递进?",
"requiredEffect": "保证等级轮廓、体型、能力幻想逐级增强。"
},
{
"key": "riskTempo",
"label": "风险节奏",
"question": "玩家在每个阶段面对的威胁压力和爽快节奏如何变化?",
"requiredEffect": "确定猎物、威胁、压迫感和爽感之间的节奏比例。"
}
]
}
]
}

View File

@@ -0,0 +1,67 @@
use std::sync::OnceLock;
use serde::Deserialize;
const ANCHOR_TEMPLATE_CONFIG: &str = include_str!("creation_agent_anchor_templates.json");
#[derive(Clone, Debug, Deserialize)]
#[serde(rename_all = "camelCase")]
pub(crate) struct CreationAgentAnchorTemplateConfig {
templates: Vec<CreationAgentAnchorTemplate>,
}
#[derive(Clone, Debug, Deserialize)]
#[serde(rename_all = "camelCase")]
pub(crate) struct CreationAgentAnchorTemplate {
pub template_id: String,
pub display_name: String,
pub creation_goal: String,
pub anchor_questions: Vec<CreationAgentAnchorQuestion>,
}
#[derive(Clone, Debug, Deserialize)]
#[serde(rename_all = "camelCase")]
pub(crate) struct CreationAgentAnchorQuestion {
pub key: String,
pub label: String,
pub question: String,
pub required_effect: String,
}
static ANCHOR_TEMPLATES: OnceLock<CreationAgentAnchorTemplateConfig> = OnceLock::new();
pub(crate) fn get_creation_agent_anchor_template(
template_id: &str,
) -> Option<&'static CreationAgentAnchorTemplate> {
load_creation_agent_anchor_templates()
.templates
.iter()
.find(|template| template.template_id == template_id)
}
pub(crate) fn render_anchor_question_block(template: &CreationAgentAnchorTemplate) -> String {
let mut lines = vec![
format!("模板目标:{}", template.creation_goal),
"".to_string(),
];
lines.push("本模板只通过以下锚点问题体现差异:".to_string());
for (index, question) in template.anchor_questions.iter().enumerate() {
lines.push(format!(
"{}. {}{} / {}{};达成效果:{}",
index + 1,
question.label,
question.key,
template.display_name,
question.question,
question.required_effect
));
}
lines.join("\n")
}
fn load_creation_agent_anchor_templates() -> &'static CreationAgentAnchorTemplateConfig {
ANCHOR_TEMPLATES.get_or_init(|| {
serde_json::from_str(ANCHOR_TEMPLATE_CONFIG)
.expect("creation_agent_anchor_templates.json 必须是合法配置")
})
}

View File

@@ -42,6 +42,7 @@ use std::convert::Infallible;
use crate::{
api_response::json_success_body,
auth::AuthenticatedAccessToken,
custom_world_agent_entities::generate_custom_world_agent_entities,
custom_world_agent_turn::{
CustomWorldAgentTurnRequest, build_failed_finalize_record_input,
build_finalize_record_input, run_custom_world_agent_turn,
@@ -916,7 +917,10 @@ pub async fn execute_custom_world_agent_action(
let owner_user_id = authenticated.claims().user_id().to_string();
let submitted_at_micros = current_utc_micros();
let payload_json = if action == "draft_foundation" {
let payload_json = if matches!(
action.as_str(),
"draft_foundation" | "generate_characters" | "generate_landmarks"
) {
let session = state
.spacetime_client()
.get_custom_world_agent_session(session_id.clone(), owner_user_id.clone())
@@ -924,15 +928,6 @@ pub async fn execute_custom_world_agent_action(
.map_err(|error| {
custom_world_error_response(&request_context, map_custom_world_client_error(error))
})?;
if session.progress_percent < 100 {
return Err(custom_world_error_response(
&request_context,
AppError::from_status(StatusCode::BAD_REQUEST).with_details(json!({
"provider": "custom-world-agent",
"message": "draft_foundation requires progressPercent >= 100",
})),
));
}
let llm_client = state.llm_client().ok_or_else(|| {
custom_world_error_response(
&request_context,
@@ -942,19 +937,29 @@ pub async fn execute_custom_world_agent_action(
})),
)
})?;
let draft_result = generate_custom_world_foundation_draft(llm_client, &session)
.await
.map_err(|message| {
custom_world_error_response(
if action == "draft_foundation" {
if session.progress_percent < 100 {
return Err(custom_world_error_response(
&request_context,
AppError::from_status(StatusCode::BAD_GATEWAY).with_details(json!({
AppError::from_status(StatusCode::BAD_REQUEST).with_details(json!({
"provider": "custom-world-agent",
"message": message,
"message": "draft_foundation requires progressPercent >= 100",
})),
)
})?;
build_draft_foundation_action_payload_json(&payload, &draft_result.draft_profile_json)
.map_err(|error| {
));
}
let draft_result = generate_custom_world_foundation_draft(llm_client, &session)
.await
.map_err(|message| {
custom_world_error_response(
&request_context,
AppError::from_status(StatusCode::BAD_GATEWAY).with_details(json!({
"provider": "custom-world-agent",
"message": message,
})),
)
})?;
build_draft_foundation_action_payload_json(&payload, &draft_result.draft_profile_json)
.map_err(|error| {
let (status, message) = match error {
DraftFoundationPayloadError::SerializePayload(message) => {
(StatusCode::BAD_REQUEST, message)
@@ -975,6 +980,21 @@ pub async fn execute_custom_world_agent_action(
})),
)
})?
} else {
let generation_result =
generate_custom_world_agent_entities(llm_client, &session, &payload)
.await
.map_err(|message| {
custom_world_error_response(
&request_context,
AppError::from_status(StatusCode::BAD_GATEWAY).with_details(json!({
"provider": "custom-world-agent",
"message": message,
})),
)
})?;
generation_result.payload_json
}
} else {
serde_json::to_string(&payload).map_err(|error| {
custom_world_error_response(

View File

@@ -0,0 +1,641 @@
use platform_llm::{LlmClient, LlmMessage, LlmTextRequest};
use serde_json::{Map as JsonMap, Value as JsonValue, json};
use shared_contracts::runtime::ExecuteCustomWorldAgentActionRequest;
use spacetime_client::CustomWorldAgentSessionRecord;
const CUSTOM_WORLD_AGENT_CHARACTER_EXPANSION_SYSTEM_PROMPT: &str =
"你负责为当前游戏世界底稿补 1 到 3 个新角色。只能输出 JSON 数组,不要输出任何额外说明。";
const CUSTOM_WORLD_AGENT_LANDMARK_EXPANSION_SYSTEM_PROMPT: &str =
"你负责为当前游戏世界底稿补 1 到 3 个新地点。只能输出 JSON 数组,不要输出任何额外说明。";
#[derive(Clone, Debug, PartialEq, Eq)]
pub struct CustomWorldGeneratedEntitiesResult {
pub payload_json: String,
}
#[derive(Clone, Debug, PartialEq, Eq)]
pub enum CustomWorldGeneratedEntitiesPayloadError {
SerializePayload(String),
InvalidPayloadShape,
}
pub async fn generate_custom_world_agent_entities(
llm_client: &LlmClient,
session: &CustomWorldAgentSessionRecord,
payload: &ExecuteCustomWorldAgentActionRequest,
) -> Result<CustomWorldGeneratedEntitiesResult, String> {
let action = payload.action.trim();
let draft_profile = session
.draft_profile
.as_object()
.ok_or_else(|| format!("{action} requires an existing draft foundation"))?;
let count = ensure_count(payload.count);
let prompt_seed = payload
.prompt_text
.as_deref()
.map(str::trim)
.filter(|value| !value.is_empty())
.unwrap_or("没有额外要求,围绕当前底稿自然扩展。");
let anchor_summary = build_anchor_summary(
draft_profile,
payload.anchor_card_ids.as_deref().unwrap_or(&[]),
);
let creator_intent_summary = session
.anchor_pack
.get("creatorIntentSummary")
.and_then(JsonValue::as_str)
.or_else(|| {
session
.creator_intent
.get("worldHook")
.and_then(JsonValue::as_str)
})
.or_else(|| draft_profile.get("summary").and_then(JsonValue::as_str))
.unwrap_or_default();
let world_name = draft_profile
.get("name")
.and_then(JsonValue::as_str)
.unwrap_or("未命名世界");
let world_summary = draft_profile
.get("summary")
.and_then(JsonValue::as_str)
.unwrap_or_default();
let (system_prompt, user_prompt, result_key) = match action {
"generate_characters" => (
CUSTOM_WORLD_AGENT_CHARACTER_EXPANSION_SYSTEM_PROMPT,
build_custom_world_agent_character_expansion_prompt(ExpansionPromptParams {
world_name,
world_summary,
creator_intent_summary,
anchor_summary: anchor_summary.as_str(),
existing_names: existing_character_names(draft_profile),
count,
prompt_seed,
}),
"generatedCharacters",
),
"generate_landmarks" => (
CUSTOM_WORLD_AGENT_LANDMARK_EXPANSION_SYSTEM_PROMPT,
build_custom_world_agent_landmark_expansion_prompt(ExpansionPromptParams {
world_name,
world_summary,
creator_intent_summary,
anchor_summary: anchor_summary.as_str(),
existing_names: existing_landmark_names(draft_profile),
count,
prompt_seed,
}),
"generatedLandmarks",
),
_ => return Err(format!("unsupported generated entity action: {action}")),
};
let response = llm_client
.request_text(LlmTextRequest::new(vec![
LlmMessage::system(system_prompt),
LlmMessage::user(user_prompt),
]))
.await
.map_err(|error| format!("{action} LLM 请求失败:{error}"))?;
let generated_entities = parse_json_array_response(response.content.as_str())
.map_err(|error| format!("{action} JSON 解析失败:{error}"))?;
let normalized_entities =
normalize_generated_entities(action, generated_entities, draft_profile, count);
let payload_json =
build_generated_entities_action_payload_json(payload, result_key, normalized_entities)
.map_err(|error| match error {
CustomWorldGeneratedEntitiesPayloadError::SerializePayload(message) => message,
CustomWorldGeneratedEntitiesPayloadError::InvalidPayloadShape => {
"action payload 必须是 object".to_string()
}
})?;
Ok(CustomWorldGeneratedEntitiesResult { payload_json })
}
pub fn build_generated_entities_action_payload_json(
payload: &ExecuteCustomWorldAgentActionRequest,
result_key: &str,
generated_entities: Vec<JsonValue>,
) -> Result<String, CustomWorldGeneratedEntitiesPayloadError> {
let mut payload_value = serde_json::to_value(payload).map_err(|error| {
CustomWorldGeneratedEntitiesPayloadError::SerializePayload(format!(
"action payload JSON 序列化失败:{error}"
))
})?;
let payload_object = payload_value
.as_object_mut()
.ok_or(CustomWorldGeneratedEntitiesPayloadError::InvalidPayloadShape)?;
if payload.action.trim() == "generate_characters" {
payload_object.insert(
"roleType".to_string(),
JsonValue::String(resolve_role_type(payload.role_type.as_deref()).to_string()),
);
}
payload_object.insert(result_key.to_string(), JsonValue::Array(generated_entities));
serde_json::to_string(&payload_value).map_err(|error| {
CustomWorldGeneratedEntitiesPayloadError::SerializePayload(format!(
"action payload JSON 序列化失败:{error}"
))
})
}
struct ExpansionPromptParams<'a> {
world_name: &'a str,
world_summary: &'a str,
creator_intent_summary: &'a str,
anchor_summary: &'a str,
existing_names: Vec<String>,
count: u32,
prompt_seed: &'a str,
}
fn build_custom_world_agent_character_expansion_prompt(
params: ExpansionPromptParams<'_>,
) -> String {
[
format!("当前世界:{}", params.world_name),
format!("世界摘要:{}", params.world_summary),
format!("创作意图摘要:{}", params.creator_intent_summary),
format!("参考锚点:{}", params.anchor_summary),
format!(
"已有角色:{}",
if params.existing_names.is_empty() {
"暂无".to_string()
} else {
params.existing_names.join("")
}
),
format!("数量:{}", params.count),
format!(
"补充要求:{}",
if params.prompt_seed.trim().is_empty() {
"没有额外要求,围绕当前底稿自然扩展。"
} else {
params.prompt_seed
}
),
"返回 JSON 数组。每个对象字段只允许包含name, role, publicMask, hiddenHook, relationToPlayer, summary, threadIds。".to_string(),
"threadIds 必须优先引用现有线程 id。".to_string(),
]
.join("\n")
}
fn build_custom_world_agent_landmark_expansion_prompt(params: ExpansionPromptParams<'_>) -> String {
[
format!("当前世界:{}", params.world_name),
format!("世界摘要:{}", params.world_summary),
format!("创作意图摘要:{}", params.creator_intent_summary),
format!("参考锚点:{}", params.anchor_summary),
format!(
"已有地点:{}",
if params.existing_names.is_empty() {
"暂无".to_string()
} else {
params.existing_names.join("")
}
),
format!("数量:{}", params.count),
format!(
"补充要求:{}",
if params.prompt_seed.trim().is_empty() {
"没有额外要求,围绕当前底稿自然扩展。"
} else {
params.prompt_seed
}
),
"返回 JSON 数组。每个对象字段只允许包含name, purpose, mood, dangerLevel, secret, summary, threadIds, characterIds。".to_string(),
"threadIds / characterIds 必须优先引用现有对象 id。".to_string(),
]
.join("\n")
}
fn ensure_count(count: Option<u32>) -> u32 {
count.unwrap_or(1).clamp(1, 3)
}
fn resolve_role_type(role_type: Option<&str>) -> &'static str {
match role_type.map(str::trim) {
Some("playable") => "playable",
_ => "story",
}
}
fn parse_json_array_response(text: &str) -> Result<Vec<JsonValue>, serde_json::Error> {
let trimmed = text.trim();
if let Some(start) = trimmed.find('[')
&& let Some(end) = trimmed.rfind(']')
&& end >= start
{
return serde_json::from_str::<Vec<JsonValue>>(&trimmed[start..=end]);
}
serde_json::from_str::<Vec<JsonValue>>(trimmed)
}
fn normalize_generated_entities(
action: &str,
entities: Vec<JsonValue>,
draft_profile: &JsonMap<String, JsonValue>,
count: u32,
) -> Vec<JsonValue> {
let mut existing_names = if action == "generate_characters" {
existing_character_names(draft_profile)
} else {
existing_landmark_names(draft_profile)
};
entities
.into_iter()
.filter_map(|entry| entry.as_object().cloned())
.filter_map(|mut object| {
let name = object
.get("name")
.and_then(JsonValue::as_str)
.map(str::trim)
.filter(|value| !value.is_empty())?
.to_string();
if existing_names.iter().any(|entry| entry == &name) {
return None;
}
existing_names.push(name.clone());
let prefix = if action == "generate_characters" {
"character"
} else {
"landmark"
};
object.entry("id".to_string()).or_insert_with(|| {
JsonValue::String(create_stable_id(
prefix,
name.as_str(),
existing_names.len(),
))
});
normalize_generated_entity_profile_fields(action, &mut object);
Some(JsonValue::Object(object))
})
.take(count as usize)
.collect()
}
fn normalize_generated_entity_profile_fields(
action: &str,
object: &mut JsonMap<String, JsonValue>,
) {
if action == "generate_characters" {
normalize_generated_character_profile_fields(object);
} else {
normalize_generated_landmark_profile_fields(object);
}
}
fn normalize_generated_character_profile_fields(object: &mut JsonMap<String, JsonValue>) {
let name = read_object_text(object, "name").unwrap_or_else(|| "新场景角色".to_string());
let role = read_object_text(object, "role").unwrap_or_else(|| "场景角色".to_string());
let summary = read_first_object_text(object, &["description", "summary", "publicMask"])
.unwrap_or_else(|| format!("{name}是围绕当前世界新补出的{role}"));
let hidden_hook = read_object_text(object, "hiddenHook").unwrap_or_else(|| summary.clone());
insert_text_if_missing(object, "title", role.as_str());
insert_text_if_missing(object, "description", summary.as_str());
insert_text_if_missing(object, "backstory", hidden_hook.as_str());
insert_text_if_missing(object, "personality", "待在后续互动中揭示");
insert_text_if_missing(object, "motivation", hidden_hook.as_str());
insert_text_if_missing(object, "combatStyle", "围绕自身身份采取行动");
object
.entry("initialAffinity".to_string())
.or_insert_with(|| JsonValue::Number(6.into()));
if !object
.get("relationshipHooks")
.is_some_and(JsonValue::is_array)
{
let mut hooks = Vec::new();
if let Some(relation) = read_object_text(object, "relationToPlayer") {
hooks.push(JsonValue::String(relation));
}
if hooks.is_empty() {
hooks.push(JsonValue::String("等待玩家接触".to_string()));
}
object.insert("relationshipHooks".to_string(), JsonValue::Array(hooks));
}
if !object.get("tags").is_some_and(JsonValue::is_array) {
object.insert(
"tags".to_string(),
JsonValue::Array(vec![JsonValue::String(role)]),
);
}
}
fn normalize_generated_landmark_profile_fields(object: &mut JsonMap<String, JsonValue>) {
let name = read_object_text(object, "name").unwrap_or_else(|| "新场景".to_string());
let description = read_first_object_text(object, &["description", "summary", "purpose"])
.unwrap_or_else(|| format!("{name}是围绕当前世界新补出的关键场景。"));
let mut description_parts = vec![description];
for key in ["mood", "secret"] {
if let Some(text) = read_object_text(object, key)
&& !description_parts.iter().any(|entry| entry == &text)
{
description_parts.push(text);
}
}
insert_text_if_missing(object, "description", description_parts.join(" ").as_str());
insert_text_if_missing(object, "dangerLevel", "");
object
.entry("connections".to_string())
.or_insert_with(|| JsonValue::Array(Vec::new()));
if !object.get("sceneNpcIds").is_some_and(JsonValue::is_array) {
let npc_ids = object
.get("characterIds")
.and_then(JsonValue::as_array)
.map(|items| {
items
.iter()
.filter_map(JsonValue::as_str)
.map(str::trim)
.filter(|value| !value.is_empty())
.map(|value| JsonValue::String(value.to_string()))
.collect::<Vec<_>>()
})
.unwrap_or_default();
object.insert("sceneNpcIds".to_string(), JsonValue::Array(npc_ids));
}
}
fn read_object_text(object: &JsonMap<String, JsonValue>, key: &str) -> Option<String> {
object
.get(key)
.and_then(JsonValue::as_str)
.map(str::trim)
.filter(|value| !value.is_empty())
.map(ToOwned::to_owned)
}
fn read_first_object_text(object: &JsonMap<String, JsonValue>, keys: &[&str]) -> Option<String> {
keys.iter().find_map(|key| read_object_text(object, key))
}
fn insert_text_if_missing(object: &mut JsonMap<String, JsonValue>, key: &str, value: &str) {
if read_object_text(object, key).is_none() {
object.insert(key.to_string(), JsonValue::String(value.to_string()));
}
}
fn existing_character_names(draft_profile: &JsonMap<String, JsonValue>) -> Vec<String> {
["playableNpcs", "storyNpcs"]
.into_iter()
.flat_map(|key| object_array_names(draft_profile.get(key)))
.take(10)
.collect()
}
fn existing_landmark_names(draft_profile: &JsonMap<String, JsonValue>) -> Vec<String> {
object_array_names(draft_profile.get("landmarks"))
.into_iter()
.take(10)
.collect()
}
fn object_array_names(value: Option<&JsonValue>) -> Vec<String> {
value
.and_then(JsonValue::as_array)
.into_iter()
.flatten()
.filter_map(|entry| entry.get("name").and_then(JsonValue::as_str))
.map(str::trim)
.filter(|value| !value.is_empty())
.map(ToOwned::to_owned)
.collect()
}
fn build_anchor_summary(
draft_profile: &JsonMap<String, JsonValue>,
anchor_card_ids: &[String],
) -> String {
let selected = anchor_card_ids
.iter()
.filter_map(|card_id| find_anchor_summary(draft_profile, card_id))
.collect::<Vec<_>>();
if !selected.is_empty() {
return selected.join("");
}
draft_profile
.get("summary")
.and_then(JsonValue::as_str)
.map(str::trim)
.filter(|value| !value.is_empty())
.unwrap_or("围绕当前世界底稿自然扩展。")
.to_string()
}
fn find_anchor_summary(
draft_profile: &JsonMap<String, JsonValue>,
card_id: &str,
) -> Option<String> {
for key in ["playableNpcs", "storyNpcs", "landmarks", "threads"] {
for entry in draft_profile.get(key)?.as_array()? {
let object = entry.as_object()?;
let id = object
.get("id")
.and_then(JsonValue::as_str)
.unwrap_or_default();
if id != card_id {
continue;
}
let name = object
.get("name")
.and_then(JsonValue::as_str)
.unwrap_or_default();
let summary = object
.get("summary")
.or_else(|| object.get("description"))
.or_else(|| object.get("publicMask"))
.and_then(JsonValue::as_str)
.unwrap_or_default();
return Some(format!("{name}{summary}"));
}
}
None
}
fn create_stable_id(prefix: &str, name: &str, index: usize) -> String {
let slug = name
.trim()
.to_lowercase()
.chars()
.map(|ch| {
if ch.is_ascii_alphanumeric() || ('\u{4e00}'..='\u{9fa5}').contains(&ch) {
ch
} else {
'-'
}
})
.collect::<String>()
.trim_matches('-')
.to_string();
format!(
"{prefix}-{}-{index}",
if slug.is_empty() {
"entry"
} else {
slug.as_str()
}
)
}
#[cfg(test)]
mod tests {
use super::*;
#[test]
fn character_expansion_prompt_keeps_node_contract_text() {
let prompt = build_custom_world_agent_character_expansion_prompt(ExpansionPromptParams {
world_name: "雾港归航",
world_summary: "守灯人追查旧案。",
creator_intent_summary: "悬疑航海",
anchor_summary: "旧灯塔:灯火错位",
existing_names: vec!["岑灯".to_string()],
count: 2,
prompt_seed: "补一个敌对角色",
});
assert!(prompt.contains("返回 JSON 数组。每个对象字段只允许包含name, role, publicMask, hiddenHook, relationToPlayer, summary, threadIds。"));
assert!(prompt.contains("threadIds 必须优先引用现有线程 id。"));
}
#[test]
fn generated_entities_payload_injects_expected_key() {
let payload = ExecuteCustomWorldAgentActionRequest {
action: "generate_landmarks".to_string(),
profile_id: None,
draft_profile: None,
legacy_result_profile: None,
setting_text: None,
card_id: None,
sections: None,
profile: None,
count: Some(1),
role_type: None,
prompt_text: Some("补地点".to_string()),
anchor_card_ids: None,
role_ids: None,
role_id: None,
portrait_path: None,
generated_visual_asset_id: None,
generated_animation_set_id: None,
animation_map: None,
scene_ids: None,
scene_id: None,
scene_kind: None,
image_src: None,
generated_scene_asset_id: None,
generated_scene_prompt: None,
generated_scene_model: None,
checkpoint_id: None,
};
let payload_json = build_generated_entities_action_payload_json(
&payload,
"generatedLandmarks",
vec![json!({ "name": "沉船湾" })],
)
.expect("payload should build");
let value = serde_json::from_str::<JsonValue>(&payload_json).expect("payload should parse");
assert_eq!(value.get("action"), Some(&json!("generate_landmarks")));
assert_eq!(
value
.get("generatedLandmarks")
.and_then(JsonValue::as_array)
.map(Vec::len),
Some(1)
);
}
#[test]
fn generated_character_payload_fills_result_profile_fields() {
let draft_profile = json!({
"playableNpcs": [],
"storyNpcs": [],
"landmarks": []
});
let entities = normalize_generated_entities(
"generate_characters",
vec![json!({
"name": "潮雾证人",
"role": "旧案目击者",
"publicMask": "总在码头边缘售卖旧航图。",
"hiddenHook": "他记得沉钟第一次响起时失踪的人。",
"relationToPlayer": "掌握玩家亲族旧案线索"
})],
draft_profile
.as_object()
.expect("draft profile should be object"),
1,
);
let character = entities[0]
.as_object()
.expect("generated character should be object");
assert_eq!(
character.get("description").and_then(JsonValue::as_str),
Some("总在码头边缘售卖旧航图。")
);
assert_eq!(
character.get("backstory").and_then(JsonValue::as_str),
Some("他记得沉钟第一次响起时失踪的人。")
);
assert_eq!(
character
.get("relationshipHooks")
.and_then(JsonValue::as_array)
.and_then(|items| items.first())
.and_then(JsonValue::as_str),
Some("掌握玩家亲族旧案线索")
);
}
#[test]
fn generated_landmark_payload_fills_scene_profile_fields() {
let draft_profile = json!({
"playableNpcs": [],
"storyNpcs": [{ "id": "character-witness", "name": "潮雾证人" }],
"landmarks": []
});
let entities = normalize_generated_entities(
"generate_landmarks",
vec![json!({
"name": "沉钟码头",
"purpose": "玩家第一次追查沉钟旧案的入口。",
"mood": "潮湿、压抑、灯火忽明忽暗。",
"secret": "码头木桩下藏着改写航道的符牌。",
"dangerLevel": "",
"characterIds": ["character-witness"]
})],
draft_profile
.as_object()
.expect("draft profile should be object"),
1,
);
let landmark = entities[0]
.as_object()
.expect("generated landmark should be object");
assert!(
landmark
.get("description")
.and_then(JsonValue::as_str)
.is_some_and(|text| text.contains("沉钟旧案") && text.contains("符牌"))
);
assert_eq!(
landmark
.get("sceneNpcIds")
.and_then(JsonValue::as_array)
.and_then(|items| items.first())
.and_then(JsonValue::as_str),
Some("character-witness")
);
}
}

View File

@@ -10,10 +10,13 @@ mod auth_public_user;
mod auth_session;
mod auth_sessions;
mod big_fish;
mod big_fish_agent_turn;
mod character_animation_assets;
mod character_visual_assets;
mod config;
mod creation_agent_anchor_templates;
mod custom_world;
mod custom_world_agent_entities;
mod custom_world_agent_turn;
mod custom_world_ai;
mod custom_world_foundation_draft;

View File

@@ -6,6 +6,10 @@ use spacetime_client::{
PuzzleAgentMessageFinalizeRecordInput, PuzzleAgentMessageRecord, PuzzleAgentSessionRecord,
};
use crate::creation_agent_anchor_templates::{
get_creation_agent_anchor_template, render_anchor_question_block,
};
#[derive(Clone, Debug)]
pub(crate) struct PuzzleAgentTurnRequest<'a> {
pub llm_client: Option<&'a LlmClient>,
@@ -59,13 +63,6 @@ const PUZZLE_AGENT_SYSTEM_PROMPT: &str = r#"你是一个负责和创作者共创
2. 当前进度 progressPercent
3. 下一轮完整可用的 nextAnchorPack
拼图创作固定围绕 5 个视觉锚点:
1. themePromise题材承诺
2. visualSubject画面主体
3. visualMood视觉气质
4. compositionHooks拼图记忆点
5. tagsAndForbidden标签与禁忌
硬约束:
1. 只能输出 JSON不能输出代码块或解释
2. nextAnchorPack 必须是完整对象,不能只输出 patch
@@ -211,8 +208,12 @@ pub(crate) fn build_failed_finalize_record_input(
}
fn build_puzzle_agent_prompt(session: &PuzzleAgentSessionRecord) -> String {
let anchor_question_block = get_creation_agent_anchor_template("puzzle")
.map(render_anchor_question_block)
.unwrap_or_else(|| "模板目标:收束成可以发布为拼图关卡的视觉方案。".to_string());
format!(
"当前是第 {turn} 轮,当前进度 {progress}% 。\n\n当前 anchor pack\n{anchor_pack}\n\n最近聊天记录:\n{chat_history}\n\n{contract}",
"{anchor_question_block}\n\n当前是第 {turn} 轮,当前进度 {progress}% 。\n\n当前 anchor pack\n{anchor_pack}\n\n最近聊天记录:\n{chat_history}\n\n{contract}",
anchor_question_block = anchor_question_block,
turn = session.current_turn.saturating_add(1),
progress = session.progress_percent,
anchor_pack = serde_json::to_string_pretty(&map_record_anchor_pack(&session.anchor_pack))

View File

@@ -321,6 +321,20 @@ pub struct BigFishMessageSubmitInput {
pub submitted_at_micros: i64,
}
#[cfg_attr(feature = "spacetime-types", derive(SpacetimeType))]
#[derive(Clone, Debug, PartialEq, Eq, Serialize, Deserialize)]
pub struct BigFishMessageFinalizeInput {
pub session_id: String,
pub owner_user_id: String,
pub assistant_message_id: Option<String>,
pub assistant_reply_text: Option<String>,
pub stage: BigFishCreationStage,
pub progress_percent: u32,
pub anchor_pack_json: String,
pub error_message: Option<String>,
pub updated_at_micros: i64,
}
#[cfg_attr(feature = "spacetime-types", derive(SpacetimeType))]
#[derive(Clone, Debug, PartialEq, Eq, Serialize, Deserialize)]
pub struct BigFishDraftCompileInput {
@@ -757,6 +771,12 @@ pub fn validate_message_submit_input(
Ok(())
}
pub fn validate_message_finalize_input(
input: &BigFishMessageFinalizeInput,
) -> Result<(), BigFishFieldError> {
validate_session_owner(&input.session_id, &input.owner_user_id)
}
pub fn validate_draft_compile_input(
input: &BigFishDraftCompileInput,
) -> Result<(), BigFishFieldError> {

View File

@@ -84,6 +84,8 @@ pub enum RpgAgentOperationType {
SyncResultProfile,
GenerateCharacters,
GenerateLandmarks,
DeleteCharacters,
DeleteLandmarks,
GenerateRoleAssets,
SyncRoleAssets,
GenerateSceneAssets,
@@ -768,6 +770,8 @@ impl RpgAgentOperationType {
Self::SyncResultProfile => "sync_result_profile",
Self::GenerateCharacters => "generate_characters",
Self::GenerateLandmarks => "generate_landmarks",
Self::DeleteCharacters => "delete_characters",
Self::DeleteLandmarks => "delete_landmarks",
Self::GenerateRoleAssets => "generate_role_assets",
Self::SyncRoleAssets => "sync_role_assets",
Self::GenerateSceneAssets => "generate_scene_assets",

View File

@@ -510,6 +510,8 @@ pub struct ExecuteCustomWorldAgentActionRequest {
#[serde(default)]
pub count: Option<u32>,
#[serde(default)]
pub role_type: Option<String>,
#[serde(default)]
pub prompt_text: Option<String>,
#[serde(default)]
pub anchor_card_ids: Option<Vec<String>>,

View File

@@ -143,6 +143,7 @@ use crate::module_bindings::{
BigFishDraftCompileInput as BindingBigFishDraftCompileInput,
BigFishGameDraft as BindingBigFishGameDraft,
BigFishLevelBlueprint as BindingBigFishLevelBlueprint,
BigFishMessageFinalizeInput as BindingBigFishMessageFinalizeInput,
BigFishMessageSubmitInput as BindingBigFishMessageSubmitInput,
BigFishPublishInput as BindingBigFishPublishInput,
BigFishRunGetInput as BindingBigFishRunGetInput,
@@ -302,6 +303,7 @@ use crate::module_bindings::{
drag_puzzle_piece_or_group_procedure::drag_puzzle_piece_or_group as _,
execute_custom_world_agent_action_procedure::execute_custom_world_agent_action as _,
fail_ai_task_and_return_procedure::fail_ai_task_and_return as _,
finalize_big_fish_agent_message_turn_procedure::finalize_big_fish_agent_message_turn as _,
finalize_custom_world_agent_message_turn_procedure::finalize_custom_world_agent_message_turn as _,
finalize_puzzle_agent_message_turn_procedure::finalize_puzzle_agent_message_turn as _,
generate_big_fish_asset_procedure::generate_big_fish_asset as _,
@@ -1574,6 +1576,35 @@ impl SpacetimeClient {
.await
}
pub async fn finalize_big_fish_agent_message(
&self,
input: BigFishMessageFinalizeRecordInput,
) -> Result<BigFishSessionRecord, SpacetimeClientError> {
let procedure_input = BindingBigFishMessageFinalizeInput {
session_id: input.session_id,
owner_user_id: input.owner_user_id,
assistant_message_id: input.assistant_message_id,
assistant_reply_text: input.assistant_reply_text,
stage: parse_big_fish_creation_stage_record(input.stage.as_str())?,
progress_percent: input.progress_percent,
anchor_pack_json: input.anchor_pack_json,
error_message: input.error_message,
updated_at_micros: input.updated_at_micros,
};
self.call_after_connect(move |connection, sender| {
connection
.procedures()
.finalize_big_fish_agent_message_turn_then(procedure_input, move |_, result| {
let mapped = result
.map_err(|error| SpacetimeClientError::Procedure(error.to_string()))
.and_then(map_big_fish_session_procedure_result);
send_once(&sender, mapped);
});
})
.await
}
pub async fn compile_big_fish_draft(
&self,
session_id: String,
@@ -5300,6 +5331,21 @@ fn format_big_fish_creation_stage(value: BindingBigFishCreationStage) -> &'stati
}
}
fn parse_big_fish_creation_stage_record(
value: &str,
) -> Result<BindingBigFishCreationStage, SpacetimeClientError> {
match value.trim() {
"collecting_anchors" => Ok(BindingBigFishCreationStage::CollectingAnchors),
"draft_ready" => Ok(BindingBigFishCreationStage::DraftReady),
"asset_refining" => Ok(BindingBigFishCreationStage::AssetRefining),
"ready_to_publish" => Ok(BindingBigFishCreationStage::ReadyToPublish),
"published" => Ok(BindingBigFishCreationStage::Published),
other => Err(SpacetimeClientError::Runtime(format!(
"未知 big fish creation stage: {other}"
))),
}
}
fn format_big_fish_anchor_status(value: BindingBigFishAnchorStatus) -> &'static str {
match value {
BindingBigFishAnchorStatus::Confirmed => "confirmed",
@@ -6445,6 +6491,19 @@ pub struct BigFishMessageSubmitRecordInput {
pub submitted_at_micros: i64,
}
#[derive(Clone, Debug, PartialEq, Eq)]
pub struct BigFishMessageFinalizeRecordInput {
pub session_id: String,
pub owner_user_id: String,
pub assistant_message_id: Option<String>,
pub assistant_reply_text: Option<String>,
pub stage: String,
pub progress_percent: u32,
pub anchor_pack_json: String,
pub error_message: Option<String>,
pub updated_at_micros: i64,
}
#[derive(Clone, Debug, PartialEq, Eq)]
pub struct BigFishAssetGenerateRecordInput {
pub session_id: String,

View File

@@ -2,7 +2,12 @@
// WILL NOT BE SAVED. MODIFY TABLES IN YOUR MODULE SOURCE CODE INSTEAD.
#![allow(unused, clippy::all)]
use spacetimedb_sdk::__codegen::{self as __sdk, __lib, __sats, __ws};
use spacetimedb_sdk::__codegen::{
self as __sdk,
__lib,
__sats,
__ws,
};
use super::quest_record_input_type::QuestRecordInput;
@@ -14,8 +19,10 @@ pub(super) struct AcceptQuestArgs {
impl From<AcceptQuestArgs> for super::Reducer {
fn from(args: AcceptQuestArgs) -> Self {
Self::AcceptQuest { input: args.input }
}
Self::AcceptQuest {
input: args.input,
}
}
}
impl __sdk::InModule for AcceptQuestArgs {
@@ -33,8 +40,9 @@ pub trait accept_quest {
/// The reducer will run asynchronously in the future,
/// and this method provides no way to listen for its completion status.
/// /// Use [`accept_quest:accept_quest_then`] to run a callback after the reducer completes.
fn accept_quest(&self, input: QuestRecordInput) -> __sdk::Result<()> {
self.accept_quest_then(input, |_, _| {})
fn accept_quest(&self, input: QuestRecordInput,
) -> __sdk::Result<()> {
self.accept_quest_then(input, |_, _| {})
}
/// Request that the remote module invoke the reducer `accept_quest` to run as soon as possible,
@@ -47,11 +55,9 @@ pub trait accept_quest {
&self,
input: QuestRecordInput,
callback: impl FnOnce(
&super::ReducerEventContext,
Result<Result<(), String>, __sdk::InternalError>,
) + Send
+ 'static,
callback: impl FnOnce(&super::ReducerEventContext, Result<Result<(), String>, __sdk::InternalError>)
+ Send
+ 'static,
) -> __sdk::Result<()>;
}
@@ -60,13 +66,11 @@ impl accept_quest for super::RemoteReducers {
&self,
input: QuestRecordInput,
callback: impl FnOnce(
&super::ReducerEventContext,
Result<Result<(), String>, __sdk::InternalError>,
) + Send
+ 'static,
callback: impl FnOnce(&super::ReducerEventContext, Result<Result<(), String>, __sdk::InternalError>)
+ Send
+ 'static,
) -> __sdk::Result<()> {
self.imp
.invoke_reducer_with_callback(AcceptQuestArgs { input }, callback)
self.imp.invoke_reducer_with_callback(AcceptQuestArgs { input, }, callback)
}
}

View File

@@ -2,7 +2,12 @@
// WILL NOT BE SAVED. MODIFY TABLES IN YOUR MODULE SOURCE CODE INSTEAD.
#![allow(unused, clippy::all)]
use spacetimedb_sdk::__codegen::{self as __sdk, __lib, __sats, __ws};
use spacetimedb_sdk::__codegen::{
self as __sdk,
__lib,
__sats,
__ws,
};
use super::quest_completion_ack_input_type::QuestCompletionAckInput;
@@ -14,8 +19,10 @@ pub(super) struct AcknowledgeQuestCompletionArgs {
impl From<AcknowledgeQuestCompletionArgs> for super::Reducer {
fn from(args: AcknowledgeQuestCompletionArgs) -> Self {
Self::AcknowledgeQuestCompletion { input: args.input }
}
Self::AcknowledgeQuestCompletion {
input: args.input,
}
}
}
impl __sdk::InModule for AcknowledgeQuestCompletionArgs {
@@ -33,8 +40,9 @@ pub trait acknowledge_quest_completion {
/// The reducer will run asynchronously in the future,
/// and this method provides no way to listen for its completion status.
/// /// Use [`acknowledge_quest_completion:acknowledge_quest_completion_then`] to run a callback after the reducer completes.
fn acknowledge_quest_completion(&self, input: QuestCompletionAckInput) -> __sdk::Result<()> {
self.acknowledge_quest_completion_then(input, |_, _| {})
fn acknowledge_quest_completion(&self, input: QuestCompletionAckInput,
) -> __sdk::Result<()> {
self.acknowledge_quest_completion_then(input, |_, _| {})
}
/// Request that the remote module invoke the reducer `acknowledge_quest_completion` to run as soon as possible,
@@ -47,11 +55,9 @@ pub trait acknowledge_quest_completion {
&self,
input: QuestCompletionAckInput,
callback: impl FnOnce(
&super::ReducerEventContext,
Result<Result<(), String>, __sdk::InternalError>,
) + Send
+ 'static,
callback: impl FnOnce(&super::ReducerEventContext, Result<Result<(), String>, __sdk::InternalError>)
+ Send
+ 'static,
) -> __sdk::Result<()>;
}
@@ -60,13 +66,11 @@ impl acknowledge_quest_completion for super::RemoteReducers {
&self,
input: QuestCompletionAckInput,
callback: impl FnOnce(
&super::ReducerEventContext,
Result<Result<(), String>, __sdk::InternalError>,
) + Send
+ 'static,
callback: impl FnOnce(&super::ReducerEventContext, Result<Result<(), String>, __sdk::InternalError>)
+ Send
+ 'static,
) -> __sdk::Result<()> {
self.imp
.invoke_reducer_with_callback(AcknowledgeQuestCompletionArgs { input }, callback)
self.imp.invoke_reducer_with_callback(AcknowledgeQuestCompletionArgs { input, }, callback)
}
}

View File

@@ -2,17 +2,23 @@
// WILL NOT BE SAVED. MODIFY TABLES IN YOUR MODULE SOURCE CODE INSTEAD.
#![allow(unused, clippy::all)]
use spacetimedb_sdk::__codegen::{self as __sdk, __lib, __sats, __ws};
use spacetimedb_sdk::__codegen::{
self as __sdk,
__lib,
__sats,
__ws,
};
use super::puzzle_run_next_level_input_type::PuzzleRunNextLevelInput;
use super::puzzle_run_procedure_result_type::PuzzleRunProcedureResult;
#[derive(__lib::ser::Serialize, __lib::de::Deserialize, Clone, PartialEq, Debug)]
#[sats(crate = __lib)]
struct AdvancePuzzleNextLevelArgs {
struct AdvancePuzzleNextLevelArgs {
pub input: PuzzleRunNextLevelInput,
}
impl __sdk::InModule for AdvancePuzzleNextLevelArgs {
type Module = super::RemoteModule;
}
@@ -22,19 +28,16 @@ impl __sdk::InModule for AdvancePuzzleNextLevelArgs {
///
/// Implemented for [`super::RemoteProcedures`].
pub trait advance_puzzle_next_level {
fn advance_puzzle_next_level(&self, input: PuzzleRunNextLevelInput) {
self.advance_puzzle_next_level_then(input, |_, _| {});
fn advance_puzzle_next_level(&self, input: PuzzleRunNextLevelInput,
) {
self.advance_puzzle_next_level_then(input, |_, _| {});
}
fn advance_puzzle_next_level_then(
&self,
input: PuzzleRunNextLevelInput,
__callback: impl FnOnce(
&super::ProcedureEventContext,
Result<PuzzleRunProcedureResult, __sdk::InternalError>,
) + Send
+ 'static,
__callback: impl FnOnce(&super::ProcedureEventContext, Result<PuzzleRunProcedureResult, __sdk::InternalError>) + Send + 'static,
);
}
@@ -43,17 +46,13 @@ impl advance_puzzle_next_level for super::RemoteProcedures {
&self,
input: PuzzleRunNextLevelInput,
__callback: impl FnOnce(
&super::ProcedureEventContext,
Result<PuzzleRunProcedureResult, __sdk::InternalError>,
) + Send
+ 'static,
__callback: impl FnOnce(&super::ProcedureEventContext, Result<PuzzleRunProcedureResult, __sdk::InternalError>) + Send + 'static,
) {
self.imp
.invoke_procedure_with_callback::<_, PuzzleRunProcedureResult>(
"advance_puzzle_next_level",
AdvancePuzzleNextLevelArgs { input },
__callback,
);
self.imp.invoke_procedure_with_callback::<_, PuzzleRunProcedureResult>(
"advance_puzzle_next_level",
AdvancePuzzleNextLevelArgs { input, },
__callback,
);
}
}

View File

@@ -2,7 +2,12 @@
// WILL NOT BE SAVED. MODIFY TABLES IN YOUR MODULE SOURCE CODE INSTEAD.
#![allow(unused, clippy::all)]
use spacetimedb_sdk::__codegen::{self as __sdk, __lib, __sats, __ws};
use spacetimedb_sdk::__codegen::{
self as __sdk,
__lib,
__sats,
__ws,
};
use super::ai_result_reference_kind_type::AiResultReferenceKind;
@@ -12,10 +17,12 @@ pub struct AiResultReferenceInput {
pub task_id: String,
pub reference_kind: AiResultReferenceKind,
pub reference_id: String,
pub label: Option<String>,
pub label: Option::<String>,
pub created_at_micros: i64,
}
impl __sdk::InModule for AiResultReferenceInput {
type Module = super::RemoteModule;
}

View File

@@ -2,7 +2,12 @@
// WILL NOT BE SAVED. MODIFY TABLES IN YOUR MODULE SOURCE CODE INSTEAD.
#![allow(unused, clippy::all)]
use spacetimedb_sdk::__codegen::{self as __sdk, __lib, __sats, __ws};
use spacetimedb_sdk::__codegen::{
self as __sdk,
__lib,
__sats,
__ws,
};
#[derive(__lib::ser::Serialize, __lib::de::Deserialize, Clone, PartialEq, Debug)]
#[sats(crate = __lib)]
@@ -19,8 +24,12 @@ pub enum AiResultReferenceKind {
RuntimeItemRecord,
AssetObject,
}
impl __sdk::InModule for AiResultReferenceKind {
type Module = super::RemoteModule;
}

View File

@@ -2,7 +2,12 @@
// WILL NOT BE SAVED. MODIFY TABLES IN YOUR MODULE SOURCE CODE INSTEAD.
#![allow(unused, clippy::all)]
use spacetimedb_sdk::__codegen::{self as __sdk, __lib, __sats, __ws};
use spacetimedb_sdk::__codegen::{
self as __sdk,
__lib,
__sats,
__ws,
};
use super::ai_result_reference_kind_type::AiResultReferenceKind;
@@ -13,10 +18,12 @@ pub struct AiResultReferenceSnapshot {
pub task_id: String,
pub reference_kind: AiResultReferenceKind,
pub reference_id: String,
pub label: Option<String>,
pub label: Option::<String>,
pub created_at_micros: i64,
}
impl __sdk::InModule for AiResultReferenceSnapshot {
type Module = super::RemoteModule;
}

View File

@@ -2,9 +2,14 @@
// WILL NOT BE SAVED. MODIFY TABLES IN YOUR MODULE SOURCE CODE INSTEAD.
#![allow(unused, clippy::all)]
use super::ai_result_reference_kind_type::AiResultReferenceKind;
use spacetimedb_sdk::__codegen::{
self as __sdk,
__lib,
__sats,
__ws,
};
use super::ai_result_reference_type::AiResultReference;
use spacetimedb_sdk::__codegen::{self as __sdk, __lib, __sats, __ws};
use super::ai_result_reference_kind_type::AiResultReferenceKind;
/// Table handle for the table `ai_result_reference`.
///
@@ -32,9 +37,7 @@ pub trait AiResultReferenceTableAccess {
impl AiResultReferenceTableAccess for super::RemoteTables {
fn ai_result_reference(&self) -> AiResultReferenceTableHandle<'_> {
AiResultReferenceTableHandle {
imp: self
.imp
.get_table::<AiResultReference>("ai_result_reference"),
imp: self.imp.get_table::<AiResultReference>("ai_result_reference"),
ctx: std::marker::PhantomData,
}
}
@@ -47,12 +50,8 @@ impl<'ctx> __sdk::Table for AiResultReferenceTableHandle<'ctx> {
type Row = AiResultReference;
type EventContext = super::EventContext;
fn count(&self) -> u64 {
self.imp.count()
}
fn iter(&self) -> impl Iterator<Item = AiResultReference> + '_ {
self.imp.iter()
}
fn count(&self) -> u64 { self.imp.count() }
fn iter(&self) -> impl Iterator<Item = AiResultReference> + '_ { self.imp.iter() }
type InsertCallbackId = AiResultReferenceInsertCallbackId;
@@ -98,44 +97,41 @@ impl<'ctx> __sdk::TableWithPrimaryKey for AiResultReferenceTableHandle<'ctx> {
}
}
/// Access to the `result_reference_row_id` unique index on the table `ai_result_reference`,
/// which allows point queries on the field of the same name
/// via the [`AiResultReferenceResultReferenceRowIdUnique::find`] method.
///
/// Users are encouraged not to explicitly reference this type,
/// but to directly chain method calls,
/// like `ctx.db.ai_result_reference().result_reference_row_id().find(...)`.
pub struct AiResultReferenceResultReferenceRowIdUnique<'ctx> {
imp: __sdk::UniqueConstraintHandle<AiResultReference, String>,
phantom: std::marker::PhantomData<&'ctx super::RemoteTables>,
}
impl<'ctx> AiResultReferenceTableHandle<'ctx> {
/// Get a handle on the `result_reference_row_id` unique index on the table `ai_result_reference`.
pub fn result_reference_row_id(&self) -> AiResultReferenceResultReferenceRowIdUnique<'ctx> {
AiResultReferenceResultReferenceRowIdUnique {
imp: self
.imp
.get_unique_constraint::<String>("result_reference_row_id"),
phantom: std::marker::PhantomData,
/// Access to the `result_reference_row_id` unique index on the table `ai_result_reference`,
/// which allows point queries on the field of the same name
/// via the [`AiResultReferenceResultReferenceRowIdUnique::find`] method.
///
/// Users are encouraged not to explicitly reference this type,
/// but to directly chain method calls,
/// like `ctx.db.ai_result_reference().result_reference_row_id().find(...)`.
pub struct AiResultReferenceResultReferenceRowIdUnique<'ctx> {
imp: __sdk::UniqueConstraintHandle<AiResultReference, String>,
phantom: std::marker::PhantomData<&'ctx super::RemoteTables>,
}
}
}
impl<'ctx> AiResultReferenceResultReferenceRowIdUnique<'ctx> {
/// Find the subscribed row whose `result_reference_row_id` column value is equal to `col_val`,
/// if such a row is present in the client cache.
pub fn find(&self, col_val: &String) -> Option<AiResultReference> {
self.imp.find(col_val)
}
}
impl<'ctx> AiResultReferenceTableHandle<'ctx> {
/// Get a handle on the `result_reference_row_id` unique index on the table `ai_result_reference`.
pub fn result_reference_row_id(&self) -> AiResultReferenceResultReferenceRowIdUnique<'ctx> {
AiResultReferenceResultReferenceRowIdUnique {
imp: self.imp.get_unique_constraint::<String>("result_reference_row_id"),
phantom: std::marker::PhantomData,
}
}
}
impl<'ctx> AiResultReferenceResultReferenceRowIdUnique<'ctx> {
/// Find the subscribed row whose `result_reference_row_id` column value is equal to `col_val`,
/// if such a row is present in the client cache.
pub fn find(&self, col_val: &String) -> Option<AiResultReference> {
self.imp.find(col_val)
}
}
#[doc(hidden)]
pub(super) fn register_table(client_cache: &mut __sdk::ClientCache<super::RemoteModule>) {
let _table = client_cache.get_or_make_table::<AiResultReference>("ai_result_reference");
_table.add_unique_constraint::<String>("result_reference_row_id", |row| {
&row.result_reference_row_id
});
_table.add_unique_constraint::<String>("result_reference_row_id", |row| &row.result_reference_row_id);
}
#[doc(hidden)]
@@ -143,24 +139,26 @@ pub(super) fn parse_table_update(
raw_updates: __ws::v2::TableUpdate,
) -> __sdk::Result<__sdk::TableUpdate<AiResultReference>> {
__sdk::TableUpdate::parse_table_update(raw_updates).map_err(|e| {
__sdk::InternalError::failed_parse("TableUpdate<AiResultReference>", "TableUpdate")
.with_cause(e)
.into()
__sdk::InternalError::failed_parse(
"TableUpdate<AiResultReference>",
"TableUpdate",
).with_cause(e).into()
})
}
#[allow(non_camel_case_types)]
/// Extension trait for query builder access to the table `AiResultReference`.
///
/// Implemented for [`__sdk::QueryTableAccessor`].
pub trait ai_result_referenceQueryTableAccess {
#[allow(non_snake_case)]
/// Get a query builder for the table `AiResultReference`.
fn ai_result_reference(&self) -> __sdk::__query_builder::Table<AiResultReference>;
}
#[allow(non_camel_case_types)]
/// Extension trait for query builder access to the table `AiResultReference`.
///
/// Implemented for [`__sdk::QueryTableAccessor`].
pub trait ai_result_referenceQueryTableAccess {
#[allow(non_snake_case)]
/// Get a query builder for the table `AiResultReference`.
fn ai_result_reference(&self) -> __sdk::__query_builder::Table<AiResultReference>;
}
impl ai_result_referenceQueryTableAccess for __sdk::QueryTableAccessor {
fn ai_result_reference(&self) -> __sdk::__query_builder::Table<AiResultReference> {
__sdk::__query_builder::Table::new("ai_result_reference")
}
}
impl ai_result_referenceQueryTableAccess for __sdk::QueryTableAccessor {
fn ai_result_reference(&self) -> __sdk::__query_builder::Table<AiResultReference> {
__sdk::__query_builder::Table::new("ai_result_reference")
}
}

View File

@@ -2,7 +2,12 @@
// WILL NOT BE SAVED. MODIFY TABLES IN YOUR MODULE SOURCE CODE INSTEAD.
#![allow(unused, clippy::all)]
use spacetimedb_sdk::__codegen::{self as __sdk, __lib, __sats, __ws};
use spacetimedb_sdk::__codegen::{
self as __sdk,
__lib,
__sats,
__ws,
};
use super::ai_result_reference_kind_type::AiResultReferenceKind;
@@ -14,14 +19,16 @@ pub struct AiResultReference {
pub task_id: String,
pub reference_kind: AiResultReferenceKind,
pub reference_id: String,
pub label: Option<String>,
pub label: Option::<String>,
pub created_at: __sdk::Timestamp,
}
impl __sdk::InModule for AiResultReference {
type Module = super::RemoteModule;
}
/// Column accessor struct for the table `AiResultReference`.
///
/// Provides typed access to columns for query building.
@@ -31,7 +38,7 @@ pub struct AiResultReferenceCols {
pub task_id: __sdk::__query_builder::Col<AiResultReference, String>,
pub reference_kind: __sdk::__query_builder::Col<AiResultReference, AiResultReferenceKind>,
pub reference_id: __sdk::__query_builder::Col<AiResultReference, String>,
pub label: __sdk::__query_builder::Col<AiResultReference, Option<String>>,
pub label: __sdk::__query_builder::Col<AiResultReference, Option::<String>>,
pub created_at: __sdk::__query_builder::Col<AiResultReference, __sdk::Timestamp>,
}
@@ -39,16 +46,14 @@ impl __sdk::__query_builder::HasCols for AiResultReference {
type Cols = AiResultReferenceCols;
fn cols(table_name: &'static str) -> Self::Cols {
AiResultReferenceCols {
result_reference_row_id: __sdk::__query_builder::Col::new(
table_name,
"result_reference_row_id",
),
result_reference_row_id: __sdk::__query_builder::Col::new(table_name, "result_reference_row_id"),
result_ref_id: __sdk::__query_builder::Col::new(table_name, "result_ref_id"),
task_id: __sdk::__query_builder::Col::new(table_name, "task_id"),
reference_kind: __sdk::__query_builder::Col::new(table_name, "reference_kind"),
reference_id: __sdk::__query_builder::Col::new(table_name, "reference_id"),
label: __sdk::__query_builder::Col::new(table_name, "label"),
created_at: __sdk::__query_builder::Col::new(table_name, "created_at"),
}
}
}
@@ -65,13 +70,12 @@ impl __sdk::__query_builder::HasIxCols for AiResultReference {
type IxCols = AiResultReferenceIxCols;
fn ix_cols(table_name: &'static str) -> Self::IxCols {
AiResultReferenceIxCols {
result_reference_row_id: __sdk::__query_builder::IxCol::new(
table_name,
"result_reference_row_id",
),
result_reference_row_id: __sdk::__query_builder::IxCol::new(table_name, "result_reference_row_id"),
task_id: __sdk::__query_builder::IxCol::new(table_name, "task_id"),
}
}
}
impl __sdk::__query_builder::CanBeLookupTable for AiResultReference {}

View File

@@ -2,7 +2,12 @@
// WILL NOT BE SAVED. MODIFY TABLES IN YOUR MODULE SOURCE CODE INSTEAD.
#![allow(unused, clippy::all)]
use spacetimedb_sdk::__codegen::{self as __sdk, __lib, __sats, __ws};
use spacetimedb_sdk::__codegen::{
self as __sdk,
__lib,
__sats,
__ws,
};
use super::ai_task_stage_kind_type::AiTaskStageKind;
@@ -11,12 +16,14 @@ use super::ai_task_stage_kind_type::AiTaskStageKind;
pub struct AiStageCompletionInput {
pub task_id: String,
pub stage_kind: AiTaskStageKind,
pub text_output: Option<String>,
pub structured_payload_json: Option<String>,
pub warning_messages: Vec<String>,
pub text_output: Option::<String>,
pub structured_payload_json: Option::<String>,
pub warning_messages: Vec::<String>,
pub completed_at_micros: i64,
}
impl __sdk::InModule for AiStageCompletionInput {
type Module = super::RemoteModule;
}

View File

@@ -2,7 +2,13 @@
// WILL NOT BE SAVED. MODIFY TABLES IN YOUR MODULE SOURCE CODE INSTEAD.
#![allow(unused, clippy::all)]
use spacetimedb_sdk::__codegen::{self as __sdk, __lib, __sats, __ws};
use spacetimedb_sdk::__codegen::{
self as __sdk,
__lib,
__sats,
__ws,
};
#[derive(__lib::ser::Serialize, __lib::de::Deserialize, Clone, PartialEq, Debug)]
#[sats(crate = __lib)]
@@ -11,6 +17,8 @@ pub struct AiTaskCancelInput {
pub completed_at_micros: i64,
}
impl __sdk::InModule for AiTaskCancelInput {
type Module = super::RemoteModule;
}

View File

@@ -2,7 +2,12 @@
// WILL NOT BE SAVED. MODIFY TABLES IN YOUR MODULE SOURCE CODE INSTEAD.
#![allow(unused, clippy::all)]
use spacetimedb_sdk::__codegen::{self as __sdk, __lib, __sats, __ws};
use spacetimedb_sdk::__codegen::{
self as __sdk,
__lib,
__sats,
__ws,
};
use super::ai_task_kind_type::AiTaskKind;
use super::ai_task_stage_blueprint_type::AiTaskStageBlueprint;
@@ -15,12 +20,14 @@ pub struct AiTaskCreateInput {
pub owner_user_id: String,
pub request_label: String,
pub source_module: String,
pub source_entity_id: Option<String>,
pub request_payload_json: Option<String>,
pub stages: Vec<AiTaskStageBlueprint>,
pub source_entity_id: Option::<String>,
pub request_payload_json: Option::<String>,
pub stages: Vec::<AiTaskStageBlueprint>,
pub created_at_micros: i64,
}
impl __sdk::InModule for AiTaskCreateInput {
type Module = super::RemoteModule;
}

View File

@@ -2,7 +2,13 @@
// WILL NOT BE SAVED. MODIFY TABLES IN YOUR MODULE SOURCE CODE INSTEAD.
#![allow(unused, clippy::all)]
use spacetimedb_sdk::__codegen::{self as __sdk, __lib, __sats, __ws};
use spacetimedb_sdk::__codegen::{
self as __sdk,
__lib,
__sats,
__ws,
};
#[derive(__lib::ser::Serialize, __lib::de::Deserialize, Clone, PartialEq, Debug)]
#[sats(crate = __lib)]
@@ -12,6 +18,8 @@ pub struct AiTaskFailureInput {
pub completed_at_micros: i64,
}
impl __sdk::InModule for AiTaskFailureInput {
type Module = super::RemoteModule;
}

View File

@@ -2,7 +2,13 @@
// WILL NOT BE SAVED. MODIFY TABLES IN YOUR MODULE SOURCE CODE INSTEAD.
#![allow(unused, clippy::all)]
use spacetimedb_sdk::__codegen::{self as __sdk, __lib, __sats, __ws};
use spacetimedb_sdk::__codegen::{
self as __sdk,
__lib,
__sats,
__ws,
};
#[derive(__lib::ser::Serialize, __lib::de::Deserialize, Clone, PartialEq, Debug)]
#[sats(crate = __lib)]
@@ -11,6 +17,8 @@ pub struct AiTaskFinishInput {
pub completed_at_micros: i64,
}
impl __sdk::InModule for AiTaskFinishInput {
type Module = super::RemoteModule;
}

View File

@@ -2,7 +2,12 @@
// WILL NOT BE SAVED. MODIFY TABLES IN YOUR MODULE SOURCE CODE INSTEAD.
#![allow(unused, clippy::all)]
use spacetimedb_sdk::__codegen::{self as __sdk, __lib, __sats, __ws};
use spacetimedb_sdk::__codegen::{
self as __sdk,
__lib,
__sats,
__ws,
};
#[derive(__lib::ser::Serialize, __lib::de::Deserialize, Clone, PartialEq, Debug)]
#[sats(crate = __lib)]
@@ -19,8 +24,12 @@ pub enum AiTaskKind {
QuestIntent,
RuntimeItemIntent,
}
impl __sdk::InModule for AiTaskKind {
type Module = super::RemoteModule;
}

View File

@@ -2,7 +2,12 @@
// WILL NOT BE SAVED. MODIFY TABLES IN YOUR MODULE SOURCE CODE INSTEAD.
#![allow(unused, clippy::all)]
use spacetimedb_sdk::__codegen::{self as __sdk, __lib, __sats, __ws};
use spacetimedb_sdk::__codegen::{
self as __sdk,
__lib,
__sats,
__ws,
};
use super::ai_task_snapshot_type::AiTaskSnapshot;
use super::ai_text_chunk_snapshot_type::AiTextChunkSnapshot;
@@ -11,11 +16,13 @@ use super::ai_text_chunk_snapshot_type::AiTextChunkSnapshot;
#[sats(crate = __lib)]
pub struct AiTaskProcedureResult {
pub ok: bool,
pub task: Option<AiTaskSnapshot>,
pub text_chunk: Option<AiTextChunkSnapshot>,
pub error_message: Option<String>,
pub task: Option::<AiTaskSnapshot>,
pub text_chunk: Option::<AiTextChunkSnapshot>,
pub error_message: Option::<String>,
}
impl __sdk::InModule for AiTaskProcedureResult {
type Module = super::RemoteModule;
}

View File

@@ -2,12 +2,17 @@
// WILL NOT BE SAVED. MODIFY TABLES IN YOUR MODULE SOURCE CODE INSTEAD.
#![allow(unused, clippy::all)]
use spacetimedb_sdk::__codegen::{self as __sdk, __lib, __sats, __ws};
use spacetimedb_sdk::__codegen::{
self as __sdk,
__lib,
__sats,
__ws,
};
use super::ai_result_reference_snapshot_type::AiResultReferenceSnapshot;
use super::ai_task_kind_type::AiTaskKind;
use super::ai_task_stage_snapshot_type::AiTaskStageSnapshot;
use super::ai_task_status_type::AiTaskStatus;
use super::ai_task_stage_snapshot_type::AiTaskStageSnapshot;
use super::ai_result_reference_snapshot_type::AiResultReferenceSnapshot;
#[derive(__lib::ser::Serialize, __lib::de::Deserialize, Clone, PartialEq, Debug)]
#[sats(crate = __lib)]
@@ -17,21 +22,23 @@ pub struct AiTaskSnapshot {
pub owner_user_id: String,
pub request_label: String,
pub source_module: String,
pub source_entity_id: Option<String>,
pub request_payload_json: Option<String>,
pub source_entity_id: Option::<String>,
pub request_payload_json: Option::<String>,
pub status: AiTaskStatus,
pub failure_message: Option<String>,
pub stages: Vec<AiTaskStageSnapshot>,
pub result_references: Vec<AiResultReferenceSnapshot>,
pub latest_text_output: Option<String>,
pub latest_structured_payload_json: Option<String>,
pub failure_message: Option::<String>,
pub stages: Vec::<AiTaskStageSnapshot>,
pub result_references: Vec::<AiResultReferenceSnapshot>,
pub latest_text_output: Option::<String>,
pub latest_structured_payload_json: Option::<String>,
pub version: u32,
pub created_at_micros: i64,
pub started_at_micros: Option<i64>,
pub completed_at_micros: Option<i64>,
pub started_at_micros: Option::<i64>,
pub completed_at_micros: Option::<i64>,
pub updated_at_micros: i64,
}
impl __sdk::InModule for AiTaskSnapshot {
type Module = super::RemoteModule;
}

View File

@@ -2,7 +2,12 @@
// WILL NOT BE SAVED. MODIFY TABLES IN YOUR MODULE SOURCE CODE INSTEAD.
#![allow(unused, clippy::all)]
use spacetimedb_sdk::__codegen::{self as __sdk, __lib, __sats, __ws};
use spacetimedb_sdk::__codegen::{
self as __sdk,
__lib,
__sats,
__ws,
};
use super::ai_task_stage_kind_type::AiTaskStageKind;
@@ -15,6 +20,8 @@ pub struct AiTaskStageBlueprint {
pub order: u32,
}
impl __sdk::InModule for AiTaskStageBlueprint {
type Module = super::RemoteModule;
}

View File

@@ -2,7 +2,12 @@
// WILL NOT BE SAVED. MODIFY TABLES IN YOUR MODULE SOURCE CODE INSTEAD.
#![allow(unused, clippy::all)]
use spacetimedb_sdk::__codegen::{self as __sdk, __lib, __sats, __ws};
use spacetimedb_sdk::__codegen::{
self as __sdk,
__lib,
__sats,
__ws,
};
#[derive(__lib::ser::Serialize, __lib::de::Deserialize, Clone, PartialEq, Debug)]
#[sats(crate = __lib)]
@@ -17,8 +22,12 @@ pub enum AiTaskStageKind {
NormalizeResult,
PersistResult,
}
impl __sdk::InModule for AiTaskStageKind {
type Module = super::RemoteModule;
}

View File

@@ -2,7 +2,12 @@
// WILL NOT BE SAVED. MODIFY TABLES IN YOUR MODULE SOURCE CODE INSTEAD.
#![allow(unused, clippy::all)]
use spacetimedb_sdk::__codegen::{self as __sdk, __lib, __sats, __ws};
use spacetimedb_sdk::__codegen::{
self as __sdk,
__lib,
__sats,
__ws,
};
use super::ai_task_stage_kind_type::AiTaskStageKind;
use super::ai_task_stage_status_type::AiTaskStageStatus;
@@ -15,13 +20,15 @@ pub struct AiTaskStageSnapshot {
pub detail: String,
pub order: u32,
pub status: AiTaskStageStatus,
pub text_output: Option<String>,
pub structured_payload_json: Option<String>,
pub warning_messages: Vec<String>,
pub started_at_micros: Option<i64>,
pub completed_at_micros: Option<i64>,
pub text_output: Option::<String>,
pub structured_payload_json: Option::<String>,
pub warning_messages: Vec::<String>,
pub started_at_micros: Option::<i64>,
pub completed_at_micros: Option::<i64>,
}
impl __sdk::InModule for AiTaskStageSnapshot {
type Module = super::RemoteModule;
}

View File

@@ -2,7 +2,12 @@
// WILL NOT BE SAVED. MODIFY TABLES IN YOUR MODULE SOURCE CODE INSTEAD.
#![allow(unused, clippy::all)]
use spacetimedb_sdk::__codegen::{self as __sdk, __lib, __sats, __ws};
use spacetimedb_sdk::__codegen::{
self as __sdk,
__lib,
__sats,
__ws,
};
use super::ai_task_stage_kind_type::AiTaskStageKind;
@@ -14,6 +19,8 @@ pub struct AiTaskStageStartInput {
pub started_at_micros: i64,
}
impl __sdk::InModule for AiTaskStageStartInput {
type Module = super::RemoteModule;
}

View File

@@ -2,7 +2,12 @@
// WILL NOT BE SAVED. MODIFY TABLES IN YOUR MODULE SOURCE CODE INSTEAD.
#![allow(unused, clippy::all)]
use spacetimedb_sdk::__codegen::{self as __sdk, __lib, __sats, __ws};
use spacetimedb_sdk::__codegen::{
self as __sdk,
__lib,
__sats,
__ws,
};
#[derive(__lib::ser::Serialize, __lib::de::Deserialize, Clone, PartialEq, Debug)]
#[sats(crate = __lib)]
@@ -15,8 +20,12 @@ pub enum AiTaskStageStatus {
Completed,
Skipped,
}
impl __sdk::InModule for AiTaskStageStatus {
type Module = super::RemoteModule;
}

View File

@@ -2,10 +2,15 @@
// WILL NOT BE SAVED. MODIFY TABLES IN YOUR MODULE SOURCE CODE INSTEAD.
#![allow(unused, clippy::all)]
use spacetimedb_sdk::__codegen::{
self as __sdk,
__lib,
__sats,
__ws,
};
use super::ai_task_stage_type::AiTaskStage;
use super::ai_task_stage_kind_type::AiTaskStageKind;
use super::ai_task_stage_status_type::AiTaskStageStatus;
use super::ai_task_stage_type::AiTaskStage;
use spacetimedb_sdk::__codegen::{self as __sdk, __lib, __sats, __ws};
/// Table handle for the table `ai_task_stage`.
///
@@ -46,12 +51,8 @@ impl<'ctx> __sdk::Table for AiTaskStageTableHandle<'ctx> {
type Row = AiTaskStage;
type EventContext = super::EventContext;
fn count(&self) -> u64 {
self.imp.count()
}
fn iter(&self) -> impl Iterator<Item = AiTaskStage> + '_ {
self.imp.iter()
}
fn count(&self) -> u64 { self.imp.count() }
fn iter(&self) -> impl Iterator<Item = AiTaskStage> + '_ { self.imp.iter() }
type InsertCallbackId = AiTaskStageInsertCallbackId;
@@ -97,38 +98,39 @@ impl<'ctx> __sdk::TableWithPrimaryKey for AiTaskStageTableHandle<'ctx> {
}
}
/// Access to the `task_stage_id` unique index on the table `ai_task_stage`,
/// which allows point queries on the field of the same name
/// via the [`AiTaskStageTaskStageIdUnique::find`] method.
///
/// Users are encouraged not to explicitly reference this type,
/// but to directly chain method calls,
/// like `ctx.db.ai_task_stage().task_stage_id().find(...)`.
pub struct AiTaskStageTaskStageIdUnique<'ctx> {
imp: __sdk::UniqueConstraintHandle<AiTaskStage, String>,
phantom: std::marker::PhantomData<&'ctx super::RemoteTables>,
}
impl<'ctx> AiTaskStageTableHandle<'ctx> {
/// Get a handle on the `task_stage_id` unique index on the table `ai_task_stage`.
pub fn task_stage_id(&self) -> AiTaskStageTaskStageIdUnique<'ctx> {
AiTaskStageTaskStageIdUnique {
imp: self.imp.get_unique_constraint::<String>("task_stage_id"),
phantom: std::marker::PhantomData,
/// Access to the `task_stage_id` unique index on the table `ai_task_stage`,
/// which allows point queries on the field of the same name
/// via the [`AiTaskStageTaskStageIdUnique::find`] method.
///
/// Users are encouraged not to explicitly reference this type,
/// but to directly chain method calls,
/// like `ctx.db.ai_task_stage().task_stage_id().find(...)`.
pub struct AiTaskStageTaskStageIdUnique<'ctx> {
imp: __sdk::UniqueConstraintHandle<AiTaskStage, String>,
phantom: std::marker::PhantomData<&'ctx super::RemoteTables>,
}
}
}
impl<'ctx> AiTaskStageTaskStageIdUnique<'ctx> {
/// Find the subscribed row whose `task_stage_id` column value is equal to `col_val`,
/// if such a row is present in the client cache.
pub fn find(&self, col_val: &String) -> Option<AiTaskStage> {
self.imp.find(col_val)
}
}
impl<'ctx> AiTaskStageTableHandle<'ctx> {
/// Get a handle on the `task_stage_id` unique index on the table `ai_task_stage`.
pub fn task_stage_id(&self) -> AiTaskStageTaskStageIdUnique<'ctx> {
AiTaskStageTaskStageIdUnique {
imp: self.imp.get_unique_constraint::<String>("task_stage_id"),
phantom: std::marker::PhantomData,
}
}
}
impl<'ctx> AiTaskStageTaskStageIdUnique<'ctx> {
/// Find the subscribed row whose `task_stage_id` column value is equal to `col_val`,
/// if such a row is present in the client cache.
pub fn find(&self, col_val: &String) -> Option<AiTaskStage> {
self.imp.find(col_val)
}
}
#[doc(hidden)]
pub(super) fn register_table(client_cache: &mut __sdk::ClientCache<super::RemoteModule>) {
let _table = client_cache.get_or_make_table::<AiTaskStage>("ai_task_stage");
_table.add_unique_constraint::<String>("task_stage_id", |row| &row.task_stage_id);
}
@@ -138,24 +140,26 @@ pub(super) fn parse_table_update(
raw_updates: __ws::v2::TableUpdate,
) -> __sdk::Result<__sdk::TableUpdate<AiTaskStage>> {
__sdk::TableUpdate::parse_table_update(raw_updates).map_err(|e| {
__sdk::InternalError::failed_parse("TableUpdate<AiTaskStage>", "TableUpdate")
.with_cause(e)
.into()
__sdk::InternalError::failed_parse(
"TableUpdate<AiTaskStage>",
"TableUpdate",
).with_cause(e).into()
})
}
#[allow(non_camel_case_types)]
/// Extension trait for query builder access to the table `AiTaskStage`.
///
/// Implemented for [`__sdk::QueryTableAccessor`].
pub trait ai_task_stageQueryTableAccess {
#[allow(non_snake_case)]
/// Get a query builder for the table `AiTaskStage`.
fn ai_task_stage(&self) -> __sdk::__query_builder::Table<AiTaskStage>;
}
#[allow(non_camel_case_types)]
/// Extension trait for query builder access to the table `AiTaskStage`.
///
/// Implemented for [`__sdk::QueryTableAccessor`].
pub trait ai_task_stageQueryTableAccess {
#[allow(non_snake_case)]
/// Get a query builder for the table `AiTaskStage`.
fn ai_task_stage(&self) -> __sdk::__query_builder::Table<AiTaskStage>;
}
impl ai_task_stageQueryTableAccess for __sdk::QueryTableAccessor {
fn ai_task_stage(&self) -> __sdk::__query_builder::Table<AiTaskStage> {
__sdk::__query_builder::Table::new("ai_task_stage")
}
}
impl ai_task_stageQueryTableAccess for __sdk::QueryTableAccessor {
fn ai_task_stage(&self) -> __sdk::__query_builder::Table<AiTaskStage> {
__sdk::__query_builder::Table::new("ai_task_stage")
}
}

View File

@@ -2,7 +2,12 @@
// WILL NOT BE SAVED. MODIFY TABLES IN YOUR MODULE SOURCE CODE INSTEAD.
#![allow(unused, clippy::all)]
use spacetimedb_sdk::__codegen::{self as __sdk, __lib, __sats, __ws};
use spacetimedb_sdk::__codegen::{
self as __sdk,
__lib,
__sats,
__ws,
};
use super::ai_task_stage_kind_type::AiTaskStageKind;
use super::ai_task_stage_status_type::AiTaskStageStatus;
@@ -17,17 +22,19 @@ pub struct AiTaskStage {
pub detail: String,
pub stage_order: u32,
pub status: AiTaskStageStatus,
pub text_output: Option<String>,
pub structured_payload_json: Option<String>,
pub warning_messages: Vec<String>,
pub started_at: Option<__sdk::Timestamp>,
pub completed_at: Option<__sdk::Timestamp>,
pub text_output: Option::<String>,
pub structured_payload_json: Option::<String>,
pub warning_messages: Vec::<String>,
pub started_at: Option::<__sdk::Timestamp>,
pub completed_at: Option::<__sdk::Timestamp>,
}
impl __sdk::InModule for AiTaskStage {
type Module = super::RemoteModule;
}
/// Column accessor struct for the table `AiTaskStage`.
///
/// Provides typed access to columns for query building.
@@ -39,11 +46,11 @@ pub struct AiTaskStageCols {
pub detail: __sdk::__query_builder::Col<AiTaskStage, String>,
pub stage_order: __sdk::__query_builder::Col<AiTaskStage, u32>,
pub status: __sdk::__query_builder::Col<AiTaskStage, AiTaskStageStatus>,
pub text_output: __sdk::__query_builder::Col<AiTaskStage, Option<String>>,
pub structured_payload_json: __sdk::__query_builder::Col<AiTaskStage, Option<String>>,
pub warning_messages: __sdk::__query_builder::Col<AiTaskStage, Vec<String>>,
pub started_at: __sdk::__query_builder::Col<AiTaskStage, Option<__sdk::Timestamp>>,
pub completed_at: __sdk::__query_builder::Col<AiTaskStage, Option<__sdk::Timestamp>>,
pub text_output: __sdk::__query_builder::Col<AiTaskStage, Option::<String>>,
pub structured_payload_json: __sdk::__query_builder::Col<AiTaskStage, Option::<String>>,
pub warning_messages: __sdk::__query_builder::Col<AiTaskStage, Vec::<String>>,
pub started_at: __sdk::__query_builder::Col<AiTaskStage, Option::<__sdk::Timestamp>>,
pub completed_at: __sdk::__query_builder::Col<AiTaskStage, Option::<__sdk::Timestamp>>,
}
impl __sdk::__query_builder::HasCols for AiTaskStage {
@@ -58,13 +65,11 @@ impl __sdk::__query_builder::HasCols for AiTaskStage {
stage_order: __sdk::__query_builder::Col::new(table_name, "stage_order"),
status: __sdk::__query_builder::Col::new(table_name, "status"),
text_output: __sdk::__query_builder::Col::new(table_name, "text_output"),
structured_payload_json: __sdk::__query_builder::Col::new(
table_name,
"structured_payload_json",
),
structured_payload_json: __sdk::__query_builder::Col::new(table_name, "structured_payload_json"),
warning_messages: __sdk::__query_builder::Col::new(table_name, "warning_messages"),
started_at: __sdk::__query_builder::Col::new(table_name, "started_at"),
completed_at: __sdk::__query_builder::Col::new(table_name, "completed_at"),
}
}
}
@@ -83,8 +88,10 @@ impl __sdk::__query_builder::HasIxCols for AiTaskStage {
AiTaskStageIxCols {
task_id: __sdk::__query_builder::IxCol::new(table_name, "task_id"),
task_stage_id: __sdk::__query_builder::IxCol::new(table_name, "task_stage_id"),
}
}
}
impl __sdk::__query_builder::CanBeLookupTable for AiTaskStage {}

View File

@@ -2,7 +2,13 @@
// WILL NOT BE SAVED. MODIFY TABLES IN YOUR MODULE SOURCE CODE INSTEAD.
#![allow(unused, clippy::all)]
use spacetimedb_sdk::__codegen::{self as __sdk, __lib, __sats, __ws};
use spacetimedb_sdk::__codegen::{
self as __sdk,
__lib,
__sats,
__ws,
};
#[derive(__lib::ser::Serialize, __lib::de::Deserialize, Clone, PartialEq, Debug)]
#[sats(crate = __lib)]
@@ -11,6 +17,8 @@ pub struct AiTaskStartInput {
pub started_at_micros: i64,
}
impl __sdk::InModule for AiTaskStartInput {
type Module = super::RemoteModule;
}

View File

@@ -2,7 +2,12 @@
// WILL NOT BE SAVED. MODIFY TABLES IN YOUR MODULE SOURCE CODE INSTEAD.
#![allow(unused, clippy::all)]
use spacetimedb_sdk::__codegen::{self as __sdk, __lib, __sats, __ws};
use spacetimedb_sdk::__codegen::{
self as __sdk,
__lib,
__sats,
__ws,
};
#[derive(__lib::ser::Serialize, __lib::de::Deserialize, Clone, PartialEq, Debug)]
#[sats(crate = __lib)]
@@ -17,8 +22,12 @@ pub enum AiTaskStatus {
Failed,
Cancelled,
}
impl __sdk::InModule for AiTaskStatus {
type Module = super::RemoteModule;
}

View File

@@ -2,10 +2,15 @@
// WILL NOT BE SAVED. MODIFY TABLES IN YOUR MODULE SOURCE CODE INSTEAD.
#![allow(unused, clippy::all)]
use spacetimedb_sdk::__codegen::{
self as __sdk,
__lib,
__sats,
__ws,
};
use super::ai_task_type::AiTask;
use super::ai_task_kind_type::AiTaskKind;
use super::ai_task_status_type::AiTaskStatus;
use super::ai_task_type::AiTask;
use spacetimedb_sdk::__codegen::{self as __sdk, __lib, __sats, __ws};
/// Table handle for the table `ai_task`.
///
@@ -46,12 +51,8 @@ impl<'ctx> __sdk::Table for AiTaskTableHandle<'ctx> {
type Row = AiTask;
type EventContext = super::EventContext;
fn count(&self) -> u64 {
self.imp.count()
}
fn iter(&self) -> impl Iterator<Item = AiTask> + '_ {
self.imp.iter()
}
fn count(&self) -> u64 { self.imp.count() }
fn iter(&self) -> impl Iterator<Item = AiTask> + '_ { self.imp.iter() }
type InsertCallbackId = AiTaskInsertCallbackId;
@@ -97,38 +98,39 @@ impl<'ctx> __sdk::TableWithPrimaryKey for AiTaskTableHandle<'ctx> {
}
}
/// Access to the `task_id` unique index on the table `ai_task`,
/// which allows point queries on the field of the same name
/// via the [`AiTaskTaskIdUnique::find`] method.
///
/// Users are encouraged not to explicitly reference this type,
/// but to directly chain method calls,
/// like `ctx.db.ai_task().task_id().find(...)`.
pub struct AiTaskTaskIdUnique<'ctx> {
imp: __sdk::UniqueConstraintHandle<AiTask, String>,
phantom: std::marker::PhantomData<&'ctx super::RemoteTables>,
}
impl<'ctx> AiTaskTableHandle<'ctx> {
/// Get a handle on the `task_id` unique index on the table `ai_task`.
pub fn task_id(&self) -> AiTaskTaskIdUnique<'ctx> {
AiTaskTaskIdUnique {
imp: self.imp.get_unique_constraint::<String>("task_id"),
phantom: std::marker::PhantomData,
/// Access to the `task_id` unique index on the table `ai_task`,
/// which allows point queries on the field of the same name
/// via the [`AiTaskTaskIdUnique::find`] method.
///
/// Users are encouraged not to explicitly reference this type,
/// but to directly chain method calls,
/// like `ctx.db.ai_task().task_id().find(...)`.
pub struct AiTaskTaskIdUnique<'ctx> {
imp: __sdk::UniqueConstraintHandle<AiTask, String>,
phantom: std::marker::PhantomData<&'ctx super::RemoteTables>,
}
}
}
impl<'ctx> AiTaskTaskIdUnique<'ctx> {
/// Find the subscribed row whose `task_id` column value is equal to `col_val`,
/// if such a row is present in the client cache.
pub fn find(&self, col_val: &String) -> Option<AiTask> {
self.imp.find(col_val)
}
}
impl<'ctx> AiTaskTableHandle<'ctx> {
/// Get a handle on the `task_id` unique index on the table `ai_task`.
pub fn task_id(&self) -> AiTaskTaskIdUnique<'ctx> {
AiTaskTaskIdUnique {
imp: self.imp.get_unique_constraint::<String>("task_id"),
phantom: std::marker::PhantomData,
}
}
}
impl<'ctx> AiTaskTaskIdUnique<'ctx> {
/// Find the subscribed row whose `task_id` column value is equal to `col_val`,
/// if such a row is present in the client cache.
pub fn find(&self, col_val: &String) -> Option<AiTask> {
self.imp.find(col_val)
}
}
#[doc(hidden)]
pub(super) fn register_table(client_cache: &mut __sdk::ClientCache<super::RemoteModule>) {
let _table = client_cache.get_or_make_table::<AiTask>("ai_task");
_table.add_unique_constraint::<String>("task_id", |row| &row.task_id);
}
@@ -138,24 +140,26 @@ pub(super) fn parse_table_update(
raw_updates: __ws::v2::TableUpdate,
) -> __sdk::Result<__sdk::TableUpdate<AiTask>> {
__sdk::TableUpdate::parse_table_update(raw_updates).map_err(|e| {
__sdk::InternalError::failed_parse("TableUpdate<AiTask>", "TableUpdate")
.with_cause(e)
.into()
__sdk::InternalError::failed_parse(
"TableUpdate<AiTask>",
"TableUpdate",
).with_cause(e).into()
})
}
#[allow(non_camel_case_types)]
/// Extension trait for query builder access to the table `AiTask`.
///
/// Implemented for [`__sdk::QueryTableAccessor`].
pub trait ai_taskQueryTableAccess {
#[allow(non_snake_case)]
/// Get a query builder for the table `AiTask`.
fn ai_task(&self) -> __sdk::__query_builder::Table<AiTask>;
}
#[allow(non_camel_case_types)]
/// Extension trait for query builder access to the table `AiTask`.
///
/// Implemented for [`__sdk::QueryTableAccessor`].
pub trait ai_taskQueryTableAccess {
#[allow(non_snake_case)]
/// Get a query builder for the table `AiTask`.
fn ai_task(&self) -> __sdk::__query_builder::Table<AiTask>;
}
impl ai_taskQueryTableAccess for __sdk::QueryTableAccessor {
fn ai_task(&self) -> __sdk::__query_builder::Table<AiTask> {
__sdk::__query_builder::Table::new("ai_task")
}
}
impl ai_taskQueryTableAccess for __sdk::QueryTableAccessor {
fn ai_task(&self) -> __sdk::__query_builder::Table<AiTask> {
__sdk::__query_builder::Table::new("ai_task")
}
}

View File

@@ -2,7 +2,12 @@
// WILL NOT BE SAVED. MODIFY TABLES IN YOUR MODULE SOURCE CODE INSTEAD.
#![allow(unused, clippy::all)]
use spacetimedb_sdk::__codegen::{self as __sdk, __lib, __sats, __ws};
use spacetimedb_sdk::__codegen::{
self as __sdk,
__lib,
__sats,
__ws,
};
use super::ai_task_kind_type::AiTaskKind;
use super::ai_task_status_type::AiTaskStatus;
@@ -15,23 +20,25 @@ pub struct AiTask {
pub owner_user_id: String,
pub request_label: String,
pub source_module: String,
pub source_entity_id: Option<String>,
pub request_payload_json: Option<String>,
pub source_entity_id: Option::<String>,
pub request_payload_json: Option::<String>,
pub status: AiTaskStatus,
pub failure_message: Option<String>,
pub latest_text_output: Option<String>,
pub latest_structured_payload_json: Option<String>,
pub failure_message: Option::<String>,
pub latest_text_output: Option::<String>,
pub latest_structured_payload_json: Option::<String>,
pub version: u32,
pub created_at: __sdk::Timestamp,
pub started_at: Option<__sdk::Timestamp>,
pub completed_at: Option<__sdk::Timestamp>,
pub started_at: Option::<__sdk::Timestamp>,
pub completed_at: Option::<__sdk::Timestamp>,
pub updated_at: __sdk::Timestamp,
}
impl __sdk::InModule for AiTask {
type Module = super::RemoteModule;
}
/// Column accessor struct for the table `AiTask`.
///
/// Provides typed access to columns for query building.
@@ -41,16 +48,16 @@ pub struct AiTaskCols {
pub owner_user_id: __sdk::__query_builder::Col<AiTask, String>,
pub request_label: __sdk::__query_builder::Col<AiTask, String>,
pub source_module: __sdk::__query_builder::Col<AiTask, String>,
pub source_entity_id: __sdk::__query_builder::Col<AiTask, Option<String>>,
pub request_payload_json: __sdk::__query_builder::Col<AiTask, Option<String>>,
pub source_entity_id: __sdk::__query_builder::Col<AiTask, Option::<String>>,
pub request_payload_json: __sdk::__query_builder::Col<AiTask, Option::<String>>,
pub status: __sdk::__query_builder::Col<AiTask, AiTaskStatus>,
pub failure_message: __sdk::__query_builder::Col<AiTask, Option<String>>,
pub latest_text_output: __sdk::__query_builder::Col<AiTask, Option<String>>,
pub latest_structured_payload_json: __sdk::__query_builder::Col<AiTask, Option<String>>,
pub failure_message: __sdk::__query_builder::Col<AiTask, Option::<String>>,
pub latest_text_output: __sdk::__query_builder::Col<AiTask, Option::<String>>,
pub latest_structured_payload_json: __sdk::__query_builder::Col<AiTask, Option::<String>>,
pub version: __sdk::__query_builder::Col<AiTask, u32>,
pub created_at: __sdk::__query_builder::Col<AiTask, __sdk::Timestamp>,
pub started_at: __sdk::__query_builder::Col<AiTask, Option<__sdk::Timestamp>>,
pub completed_at: __sdk::__query_builder::Col<AiTask, Option<__sdk::Timestamp>>,
pub started_at: __sdk::__query_builder::Col<AiTask, Option::<__sdk::Timestamp>>,
pub completed_at: __sdk::__query_builder::Col<AiTask, Option::<__sdk::Timestamp>>,
pub updated_at: __sdk::__query_builder::Col<AiTask, __sdk::Timestamp>,
}
@@ -64,22 +71,17 @@ impl __sdk::__query_builder::HasCols for AiTask {
request_label: __sdk::__query_builder::Col::new(table_name, "request_label"),
source_module: __sdk::__query_builder::Col::new(table_name, "source_module"),
source_entity_id: __sdk::__query_builder::Col::new(table_name, "source_entity_id"),
request_payload_json: __sdk::__query_builder::Col::new(
table_name,
"request_payload_json",
),
request_payload_json: __sdk::__query_builder::Col::new(table_name, "request_payload_json"),
status: __sdk::__query_builder::Col::new(table_name, "status"),
failure_message: __sdk::__query_builder::Col::new(table_name, "failure_message"),
latest_text_output: __sdk::__query_builder::Col::new(table_name, "latest_text_output"),
latest_structured_payload_json: __sdk::__query_builder::Col::new(
table_name,
"latest_structured_payload_json",
),
latest_structured_payload_json: __sdk::__query_builder::Col::new(table_name, "latest_structured_payload_json"),
version: __sdk::__query_builder::Col::new(table_name, "version"),
created_at: __sdk::__query_builder::Col::new(table_name, "created_at"),
started_at: __sdk::__query_builder::Col::new(table_name, "started_at"),
completed_at: __sdk::__query_builder::Col::new(table_name, "completed_at"),
updated_at: __sdk::__query_builder::Col::new(table_name, "updated_at"),
}
}
}
@@ -102,8 +104,10 @@ impl __sdk::__query_builder::HasIxCols for AiTask {
status: __sdk::__query_builder::IxCol::new(table_name, "status"),
task_id: __sdk::__query_builder::IxCol::new(table_name, "task_id"),
task_kind: __sdk::__query_builder::IxCol::new(table_name, "task_kind"),
}
}
}
impl __sdk::__query_builder::CanBeLookupTable for AiTask {}

View File

@@ -2,7 +2,12 @@
// WILL NOT BE SAVED. MODIFY TABLES IN YOUR MODULE SOURCE CODE INSTEAD.
#![allow(unused, clippy::all)]
use spacetimedb_sdk::__codegen::{self as __sdk, __lib, __sats, __ws};
use spacetimedb_sdk::__codegen::{
self as __sdk,
__lib,
__sats,
__ws,
};
use super::ai_task_stage_kind_type::AiTaskStageKind;
@@ -16,6 +21,8 @@ pub struct AiTextChunkAppendInput {
pub created_at_micros: i64,
}
impl __sdk::InModule for AiTextChunkAppendInput {
type Module = super::RemoteModule;
}

View File

@@ -2,7 +2,12 @@
// WILL NOT BE SAVED. MODIFY TABLES IN YOUR MODULE SOURCE CODE INSTEAD.
#![allow(unused, clippy::all)]
use spacetimedb_sdk::__codegen::{self as __sdk, __lib, __sats, __ws};
use spacetimedb_sdk::__codegen::{
self as __sdk,
__lib,
__sats,
__ws,
};
use super::ai_task_stage_kind_type::AiTaskStageKind;
@@ -17,6 +22,8 @@ pub struct AiTextChunkSnapshot {
pub created_at_micros: i64,
}
impl __sdk::InModule for AiTextChunkSnapshot {
type Module = super::RemoteModule;
}

View File

@@ -2,9 +2,14 @@
// WILL NOT BE SAVED. MODIFY TABLES IN YOUR MODULE SOURCE CODE INSTEAD.
#![allow(unused, clippy::all)]
use super::ai_task_stage_kind_type::AiTaskStageKind;
use spacetimedb_sdk::__codegen::{
self as __sdk,
__lib,
__sats,
__ws,
};
use super::ai_text_chunk_type::AiTextChunk;
use spacetimedb_sdk::__codegen::{self as __sdk, __lib, __sats, __ws};
use super::ai_task_stage_kind_type::AiTaskStageKind;
/// Table handle for the table `ai_text_chunk`.
///
@@ -45,12 +50,8 @@ impl<'ctx> __sdk::Table for AiTextChunkTableHandle<'ctx> {
type Row = AiTextChunk;
type EventContext = super::EventContext;
fn count(&self) -> u64 {
self.imp.count()
}
fn iter(&self) -> impl Iterator<Item = AiTextChunk> + '_ {
self.imp.iter()
}
fn count(&self) -> u64 { self.imp.count() }
fn iter(&self) -> impl Iterator<Item = AiTextChunk> + '_ { self.imp.iter() }
type InsertCallbackId = AiTextChunkInsertCallbackId;
@@ -96,40 +97,39 @@ impl<'ctx> __sdk::TableWithPrimaryKey for AiTextChunkTableHandle<'ctx> {
}
}
/// Access to the `text_chunk_row_id` unique index on the table `ai_text_chunk`,
/// which allows point queries on the field of the same name
/// via the [`AiTextChunkTextChunkRowIdUnique::find`] method.
///
/// Users are encouraged not to explicitly reference this type,
/// but to directly chain method calls,
/// like `ctx.db.ai_text_chunk().text_chunk_row_id().find(...)`.
pub struct AiTextChunkTextChunkRowIdUnique<'ctx> {
imp: __sdk::UniqueConstraintHandle<AiTextChunk, String>,
phantom: std::marker::PhantomData<&'ctx super::RemoteTables>,
}
impl<'ctx> AiTextChunkTableHandle<'ctx> {
/// Get a handle on the `text_chunk_row_id` unique index on the table `ai_text_chunk`.
pub fn text_chunk_row_id(&self) -> AiTextChunkTextChunkRowIdUnique<'ctx> {
AiTextChunkTextChunkRowIdUnique {
imp: self
.imp
.get_unique_constraint::<String>("text_chunk_row_id"),
phantom: std::marker::PhantomData,
/// Access to the `text_chunk_row_id` unique index on the table `ai_text_chunk`,
/// which allows point queries on the field of the same name
/// via the [`AiTextChunkTextChunkRowIdUnique::find`] method.
///
/// Users are encouraged not to explicitly reference this type,
/// but to directly chain method calls,
/// like `ctx.db.ai_text_chunk().text_chunk_row_id().find(...)`.
pub struct AiTextChunkTextChunkRowIdUnique<'ctx> {
imp: __sdk::UniqueConstraintHandle<AiTextChunk, String>,
phantom: std::marker::PhantomData<&'ctx super::RemoteTables>,
}
}
}
impl<'ctx> AiTextChunkTextChunkRowIdUnique<'ctx> {
/// Find the subscribed row whose `text_chunk_row_id` column value is equal to `col_val`,
/// if such a row is present in the client cache.
pub fn find(&self, col_val: &String) -> Option<AiTextChunk> {
self.imp.find(col_val)
}
}
impl<'ctx> AiTextChunkTableHandle<'ctx> {
/// Get a handle on the `text_chunk_row_id` unique index on the table `ai_text_chunk`.
pub fn text_chunk_row_id(&self) -> AiTextChunkTextChunkRowIdUnique<'ctx> {
AiTextChunkTextChunkRowIdUnique {
imp: self.imp.get_unique_constraint::<String>("text_chunk_row_id"),
phantom: std::marker::PhantomData,
}
}
}
impl<'ctx> AiTextChunkTextChunkRowIdUnique<'ctx> {
/// Find the subscribed row whose `text_chunk_row_id` column value is equal to `col_val`,
/// if such a row is present in the client cache.
pub fn find(&self, col_val: &String) -> Option<AiTextChunk> {
self.imp.find(col_val)
}
}
#[doc(hidden)]
pub(super) fn register_table(client_cache: &mut __sdk::ClientCache<super::RemoteModule>) {
let _table = client_cache.get_or_make_table::<AiTextChunk>("ai_text_chunk");
_table.add_unique_constraint::<String>("text_chunk_row_id", |row| &row.text_chunk_row_id);
}
@@ -139,24 +139,26 @@ pub(super) fn parse_table_update(
raw_updates: __ws::v2::TableUpdate,
) -> __sdk::Result<__sdk::TableUpdate<AiTextChunk>> {
__sdk::TableUpdate::parse_table_update(raw_updates).map_err(|e| {
__sdk::InternalError::failed_parse("TableUpdate<AiTextChunk>", "TableUpdate")
.with_cause(e)
.into()
__sdk::InternalError::failed_parse(
"TableUpdate<AiTextChunk>",
"TableUpdate",
).with_cause(e).into()
})
}
#[allow(non_camel_case_types)]
/// Extension trait for query builder access to the table `AiTextChunk`.
///
/// Implemented for [`__sdk::QueryTableAccessor`].
pub trait ai_text_chunkQueryTableAccess {
#[allow(non_snake_case)]
/// Get a query builder for the table `AiTextChunk`.
fn ai_text_chunk(&self) -> __sdk::__query_builder::Table<AiTextChunk>;
}
#[allow(non_camel_case_types)]
/// Extension trait for query builder access to the table `AiTextChunk`.
///
/// Implemented for [`__sdk::QueryTableAccessor`].
pub trait ai_text_chunkQueryTableAccess {
#[allow(non_snake_case)]
/// Get a query builder for the table `AiTextChunk`.
fn ai_text_chunk(&self) -> __sdk::__query_builder::Table<AiTextChunk>;
}
impl ai_text_chunkQueryTableAccess for __sdk::QueryTableAccessor {
fn ai_text_chunk(&self) -> __sdk::__query_builder::Table<AiTextChunk> {
__sdk::__query_builder::Table::new("ai_text_chunk")
}
}
impl ai_text_chunkQueryTableAccess for __sdk::QueryTableAccessor {
fn ai_text_chunk(&self) -> __sdk::__query_builder::Table<AiTextChunk> {
__sdk::__query_builder::Table::new("ai_text_chunk")
}
}

View File

@@ -2,7 +2,12 @@
// WILL NOT BE SAVED. MODIFY TABLES IN YOUR MODULE SOURCE CODE INSTEAD.
#![allow(unused, clippy::all)]
use spacetimedb_sdk::__codegen::{self as __sdk, __lib, __sats, __ws};
use spacetimedb_sdk::__codegen::{
self as __sdk,
__lib,
__sats,
__ws,
};
use super::ai_task_stage_kind_type::AiTaskStageKind;
@@ -18,10 +23,12 @@ pub struct AiTextChunk {
pub created_at: __sdk::Timestamp,
}
impl __sdk::InModule for AiTextChunk {
type Module = super::RemoteModule;
}
/// Column accessor struct for the table `AiTextChunk`.
///
/// Provides typed access to columns for query building.
@@ -46,6 +53,7 @@ impl __sdk::__query_builder::HasCols for AiTextChunk {
sequence: __sdk::__query_builder::Col::new(table_name, "sequence"),
delta_text: __sdk::__query_builder::Col::new(table_name, "delta_text"),
created_at: __sdk::__query_builder::Col::new(table_name, "created_at"),
}
}
}
@@ -64,8 +72,10 @@ impl __sdk::__query_builder::HasIxCols for AiTextChunk {
AiTextChunkIxCols {
task_id: __sdk::__query_builder::IxCol::new(table_name, "task_id"),
text_chunk_row_id: __sdk::__query_builder::IxCol::new(table_name, "text_chunk_row_id"),
}
}
}
impl __sdk::__query_builder::CanBeLookupTable for AiTextChunk {}

View File

@@ -2,17 +2,23 @@
// WILL NOT BE SAVED. MODIFY TABLES IN YOUR MODULE SOURCE CODE INSTEAD.
#![allow(unused, clippy::all)]
use spacetimedb_sdk::__codegen::{self as __sdk, __lib, __sats, __ws};
use spacetimedb_sdk::__codegen::{
self as __sdk,
__lib,
__sats,
__ws,
};
use super::ai_task_procedure_result_type::AiTaskProcedureResult;
use super::ai_text_chunk_append_input_type::AiTextChunkAppendInput;
use super::ai_task_procedure_result_type::AiTaskProcedureResult;
#[derive(__lib::ser::Serialize, __lib::de::Deserialize, Clone, PartialEq, Debug)]
#[sats(crate = __lib)]
struct AppendAiTextChunkAndReturnArgs {
struct AppendAiTextChunkAndReturnArgs {
pub input: AiTextChunkAppendInput,
}
impl __sdk::InModule for AppendAiTextChunkAndReturnArgs {
type Module = super::RemoteModule;
}
@@ -22,19 +28,16 @@ impl __sdk::InModule for AppendAiTextChunkAndReturnArgs {
///
/// Implemented for [`super::RemoteProcedures`].
pub trait append_ai_text_chunk_and_return {
fn append_ai_text_chunk_and_return(&self, input: AiTextChunkAppendInput) {
self.append_ai_text_chunk_and_return_then(input, |_, _| {});
fn append_ai_text_chunk_and_return(&self, input: AiTextChunkAppendInput,
) {
self.append_ai_text_chunk_and_return_then(input, |_, _| {});
}
fn append_ai_text_chunk_and_return_then(
&self,
input: AiTextChunkAppendInput,
__callback: impl FnOnce(
&super::ProcedureEventContext,
Result<AiTaskProcedureResult, __sdk::InternalError>,
) + Send
+ 'static,
__callback: impl FnOnce(&super::ProcedureEventContext, Result<AiTaskProcedureResult, __sdk::InternalError>) + Send + 'static,
);
}
@@ -43,17 +46,13 @@ impl append_ai_text_chunk_and_return for super::RemoteProcedures {
&self,
input: AiTextChunkAppendInput,
__callback: impl FnOnce(
&super::ProcedureEventContext,
Result<AiTaskProcedureResult, __sdk::InternalError>,
) + Send
+ 'static,
__callback: impl FnOnce(&super::ProcedureEventContext, Result<AiTaskProcedureResult, __sdk::InternalError>) + Send + 'static,
) {
self.imp
.invoke_procedure_with_callback::<_, AiTaskProcedureResult>(
"append_ai_text_chunk_and_return",
AppendAiTextChunkAndReturnArgs { input },
__callback,
);
self.imp.invoke_procedure_with_callback::<_, AiTaskProcedureResult>(
"append_ai_text_chunk_and_return",
AppendAiTextChunkAndReturnArgs { input, },
__callback,
);
}
}

View File

@@ -2,17 +2,23 @@
// WILL NOT BE SAVED. MODIFY TABLES IN YOUR MODULE SOURCE CODE INSTEAD.
#![allow(unused, clippy::all)]
use spacetimedb_sdk::__codegen::{self as __sdk, __lib, __sats, __ws};
use spacetimedb_sdk::__codegen::{
self as __sdk,
__lib,
__sats,
__ws,
};
use super::chapter_progression_ledger_input_type::ChapterProgressionLedgerInput;
use super::chapter_progression_procedure_result_type::ChapterProgressionProcedureResult;
#[derive(__lib::ser::Serialize, __lib::de::Deserialize, Clone, PartialEq, Debug)]
#[sats(crate = __lib)]
struct ApplyChapterProgressionLedgerEntryAndReturnArgs {
struct ApplyChapterProgressionLedgerEntryAndReturnArgs {
pub input: ChapterProgressionLedgerInput,
}
impl __sdk::InModule for ApplyChapterProgressionLedgerEntryAndReturnArgs {
type Module = super::RemoteModule;
}
@@ -22,22 +28,16 @@ impl __sdk::InModule for ApplyChapterProgressionLedgerEntryAndReturnArgs {
///
/// Implemented for [`super::RemoteProcedures`].
pub trait apply_chapter_progression_ledger_entry_and_return {
fn apply_chapter_progression_ledger_entry_and_return(
&self,
input: ChapterProgressionLedgerInput,
) {
self.apply_chapter_progression_ledger_entry_and_return_then(input, |_, _| {});
fn apply_chapter_progression_ledger_entry_and_return(&self, input: ChapterProgressionLedgerInput,
) {
self.apply_chapter_progression_ledger_entry_and_return_then(input, |_, _| {});
}
fn apply_chapter_progression_ledger_entry_and_return_then(
&self,
input: ChapterProgressionLedgerInput,
__callback: impl FnOnce(
&super::ProcedureEventContext,
Result<ChapterProgressionProcedureResult, __sdk::InternalError>,
) + Send
+ 'static,
__callback: impl FnOnce(&super::ProcedureEventContext, Result<ChapterProgressionProcedureResult, __sdk::InternalError>) + Send + 'static,
);
}
@@ -46,17 +46,13 @@ impl apply_chapter_progression_ledger_entry_and_return for super::RemoteProcedur
&self,
input: ChapterProgressionLedgerInput,
__callback: impl FnOnce(
&super::ProcedureEventContext,
Result<ChapterProgressionProcedureResult, __sdk::InternalError>,
) + Send
+ 'static,
__callback: impl FnOnce(&super::ProcedureEventContext, Result<ChapterProgressionProcedureResult, __sdk::InternalError>) + Send + 'static,
) {
self.imp
.invoke_procedure_with_callback::<_, ChapterProgressionProcedureResult>(
"apply_chapter_progression_ledger_entry_and_return",
ApplyChapterProgressionLedgerEntryAndReturnArgs { input },
__callback,
);
self.imp.invoke_procedure_with_callback::<_, ChapterProgressionProcedureResult>(
"apply_chapter_progression_ledger_entry_and_return",
ApplyChapterProgressionLedgerEntryAndReturnArgs { input, },
__callback,
);
}
}

View File

@@ -2,7 +2,12 @@
// WILL NOT BE SAVED. MODIFY TABLES IN YOUR MODULE SOURCE CODE INSTEAD.
#![allow(unused, clippy::all)]
use spacetimedb_sdk::__codegen::{self as __sdk, __lib, __sats, __ws};
use spacetimedb_sdk::__codegen::{
self as __sdk,
__lib,
__sats,
__ws,
};
use super::chapter_progression_ledger_input_type::ChapterProgressionLedgerInput;
@@ -14,8 +19,10 @@ pub(super) struct ApplyChapterProgressionLedgerEntryArgs {
impl From<ApplyChapterProgressionLedgerEntryArgs> for super::Reducer {
fn from(args: ApplyChapterProgressionLedgerEntryArgs) -> Self {
Self::ApplyChapterProgressionLedgerEntry { input: args.input }
}
Self::ApplyChapterProgressionLedgerEntry {
input: args.input,
}
}
}
impl __sdk::InModule for ApplyChapterProgressionLedgerEntryArgs {
@@ -33,11 +40,9 @@ pub trait apply_chapter_progression_ledger_entry {
/// The reducer will run asynchronously in the future,
/// and this method provides no way to listen for its completion status.
/// /// Use [`apply_chapter_progression_ledger_entry:apply_chapter_progression_ledger_entry_then`] to run a callback after the reducer completes.
fn apply_chapter_progression_ledger_entry(
&self,
input: ChapterProgressionLedgerInput,
) -> __sdk::Result<()> {
self.apply_chapter_progression_ledger_entry_then(input, |_, _| {})
fn apply_chapter_progression_ledger_entry(&self, input: ChapterProgressionLedgerInput,
) -> __sdk::Result<()> {
self.apply_chapter_progression_ledger_entry_then(input, |_, _| {})
}
/// Request that the remote module invoke the reducer `apply_chapter_progression_ledger_entry` to run as soon as possible,
@@ -50,11 +55,9 @@ pub trait apply_chapter_progression_ledger_entry {
&self,
input: ChapterProgressionLedgerInput,
callback: impl FnOnce(
&super::ReducerEventContext,
Result<Result<(), String>, __sdk::InternalError>,
) + Send
+ 'static,
callback: impl FnOnce(&super::ReducerEventContext, Result<Result<(), String>, __sdk::InternalError>)
+ Send
+ 'static,
) -> __sdk::Result<()>;
}
@@ -63,15 +66,11 @@ impl apply_chapter_progression_ledger_entry for super::RemoteReducers {
&self,
input: ChapterProgressionLedgerInput,
callback: impl FnOnce(
&super::ReducerEventContext,
Result<Result<(), String>, __sdk::InternalError>,
) + Send
+ 'static,
callback: impl FnOnce(&super::ReducerEventContext, Result<Result<(), String>, __sdk::InternalError>)
+ Send
+ 'static,
) -> __sdk::Result<()> {
self.imp.invoke_reducer_with_callback(
ApplyChapterProgressionLedgerEntryArgs { input },
callback,
)
self.imp.invoke_reducer_with_callback(ApplyChapterProgressionLedgerEntryArgs { input, }, callback)
}
}

View File

@@ -2,7 +2,12 @@
// WILL NOT BE SAVED. MODIFY TABLES IN YOUR MODULE SOURCE CODE INSTEAD.
#![allow(unused, clippy::all)]
use spacetimedb_sdk::__codegen::{self as __sdk, __lib, __sats, __ws};
use spacetimedb_sdk::__codegen::{
self as __sdk,
__lib,
__sats,
__ws,
};
use super::inventory_mutation_input_type::InventoryMutationInput;
@@ -14,8 +19,10 @@ pub(super) struct ApplyInventoryMutationArgs {
impl From<ApplyInventoryMutationArgs> for super::Reducer {
fn from(args: ApplyInventoryMutationArgs) -> Self {
Self::ApplyInventoryMutation { input: args.input }
}
Self::ApplyInventoryMutation {
input: args.input,
}
}
}
impl __sdk::InModule for ApplyInventoryMutationArgs {
@@ -33,8 +40,9 @@ pub trait apply_inventory_mutation {
/// The reducer will run asynchronously in the future,
/// and this method provides no way to listen for its completion status.
/// /// Use [`apply_inventory_mutation:apply_inventory_mutation_then`] to run a callback after the reducer completes.
fn apply_inventory_mutation(&self, input: InventoryMutationInput) -> __sdk::Result<()> {
self.apply_inventory_mutation_then(input, |_, _| {})
fn apply_inventory_mutation(&self, input: InventoryMutationInput,
) -> __sdk::Result<()> {
self.apply_inventory_mutation_then(input, |_, _| {})
}
/// Request that the remote module invoke the reducer `apply_inventory_mutation` to run as soon as possible,
@@ -47,11 +55,9 @@ pub trait apply_inventory_mutation {
&self,
input: InventoryMutationInput,
callback: impl FnOnce(
&super::ReducerEventContext,
Result<Result<(), String>, __sdk::InternalError>,
) + Send
+ 'static,
callback: impl FnOnce(&super::ReducerEventContext, Result<Result<(), String>, __sdk::InternalError>)
+ Send
+ 'static,
) -> __sdk::Result<()>;
}
@@ -60,13 +66,11 @@ impl apply_inventory_mutation for super::RemoteReducers {
&self,
input: InventoryMutationInput,
callback: impl FnOnce(
&super::ReducerEventContext,
Result<Result<(), String>, __sdk::InternalError>,
) + Send
+ 'static,
callback: impl FnOnce(&super::ReducerEventContext, Result<Result<(), String>, __sdk::InternalError>)
+ Send
+ 'static,
) -> __sdk::Result<()> {
self.imp
.invoke_reducer_with_callback(ApplyInventoryMutationArgs { input }, callback)
self.imp.invoke_reducer_with_callback(ApplyInventoryMutationArgs { input, }, callback)
}
}

View File

@@ -2,7 +2,12 @@
// WILL NOT BE SAVED. MODIFY TABLES IN YOUR MODULE SOURCE CODE INSTEAD.
#![allow(unused, clippy::all)]
use spacetimedb_sdk::__codegen::{self as __sdk, __lib, __sats, __ws};
use spacetimedb_sdk::__codegen::{
self as __sdk,
__lib,
__sats,
__ws,
};
use super::quest_signal_apply_input_type::QuestSignalApplyInput;
@@ -14,8 +19,10 @@ pub(super) struct ApplyQuestSignalArgs {
impl From<ApplyQuestSignalArgs> for super::Reducer {
fn from(args: ApplyQuestSignalArgs) -> Self {
Self::ApplyQuestSignal { input: args.input }
}
Self::ApplyQuestSignal {
input: args.input,
}
}
}
impl __sdk::InModule for ApplyQuestSignalArgs {
@@ -33,8 +40,9 @@ pub trait apply_quest_signal {
/// The reducer will run asynchronously in the future,
/// and this method provides no way to listen for its completion status.
/// /// Use [`apply_quest_signal:apply_quest_signal_then`] to run a callback after the reducer completes.
fn apply_quest_signal(&self, input: QuestSignalApplyInput) -> __sdk::Result<()> {
self.apply_quest_signal_then(input, |_, _| {})
fn apply_quest_signal(&self, input: QuestSignalApplyInput,
) -> __sdk::Result<()> {
self.apply_quest_signal_then(input, |_, _| {})
}
/// Request that the remote module invoke the reducer `apply_quest_signal` to run as soon as possible,
@@ -47,11 +55,9 @@ pub trait apply_quest_signal {
&self,
input: QuestSignalApplyInput,
callback: impl FnOnce(
&super::ReducerEventContext,
Result<Result<(), String>, __sdk::InternalError>,
) + Send
+ 'static,
callback: impl FnOnce(&super::ReducerEventContext, Result<Result<(), String>, __sdk::InternalError>)
+ Send
+ 'static,
) -> __sdk::Result<()>;
}
@@ -60,13 +66,11 @@ impl apply_quest_signal for super::RemoteReducers {
&self,
input: QuestSignalApplyInput,
callback: impl FnOnce(
&super::ReducerEventContext,
Result<Result<(), String>, __sdk::InternalError>,
) + Send
+ 'static,
callback: impl FnOnce(&super::ReducerEventContext, Result<Result<(), String>, __sdk::InternalError>)
+ Send
+ 'static,
) -> __sdk::Result<()> {
self.imp
.invoke_reducer_with_callback(ApplyQuestSignalArgs { input }, callback)
self.imp.invoke_reducer_with_callback(ApplyQuestSignalArgs { input, }, callback)
}
}

View File

@@ -2,7 +2,13 @@
// WILL NOT BE SAVED. MODIFY TABLES IN YOUR MODULE SOURCE CODE INSTEAD.
#![allow(unused, clippy::all)]
use spacetimedb_sdk::__codegen::{self as __sdk, __lib, __sats, __ws};
use spacetimedb_sdk::__codegen::{
self as __sdk,
__lib,
__sats,
__ws,
};
#[derive(__lib::ser::Serialize, __lib::de::Deserialize, Clone, PartialEq, Debug)]
#[sats(crate = __lib)]
@@ -13,11 +19,13 @@ pub struct AssetEntityBindingInput {
pub entity_id: String,
pub slot: String,
pub asset_kind: String,
pub owner_user_id: Option<String>,
pub profile_id: Option<String>,
pub owner_user_id: Option::<String>,
pub profile_id: Option::<String>,
pub updated_at_micros: i64,
}
impl __sdk::InModule for AssetEntityBindingInput {
type Module = super::RemoteModule;
}

View File

@@ -2,7 +2,12 @@
// WILL NOT BE SAVED. MODIFY TABLES IN YOUR MODULE SOURCE CODE INSTEAD.
#![allow(unused, clippy::all)]
use spacetimedb_sdk::__codegen::{self as __sdk, __lib, __sats, __ws};
use spacetimedb_sdk::__codegen::{
self as __sdk,
__lib,
__sats,
__ws,
};
use super::asset_entity_binding_snapshot_type::AssetEntityBindingSnapshot;
@@ -10,10 +15,12 @@ use super::asset_entity_binding_snapshot_type::AssetEntityBindingSnapshot;
#[sats(crate = __lib)]
pub struct AssetEntityBindingProcedureResult {
pub ok: bool,
pub record: Option<AssetEntityBindingSnapshot>,
pub error_message: Option<String>,
pub record: Option::<AssetEntityBindingSnapshot>,
pub error_message: Option::<String>,
}
impl __sdk::InModule for AssetEntityBindingProcedureResult {
type Module = super::RemoteModule;
}

View File

@@ -2,7 +2,13 @@
// WILL NOT BE SAVED. MODIFY TABLES IN YOUR MODULE SOURCE CODE INSTEAD.
#![allow(unused, clippy::all)]
use spacetimedb_sdk::__codegen::{self as __sdk, __lib, __sats, __ws};
use spacetimedb_sdk::__codegen::{
self as __sdk,
__lib,
__sats,
__ws,
};
#[derive(__lib::ser::Serialize, __lib::de::Deserialize, Clone, PartialEq, Debug)]
#[sats(crate = __lib)]
@@ -13,12 +19,14 @@ pub struct AssetEntityBindingSnapshot {
pub entity_id: String,
pub slot: String,
pub asset_kind: String,
pub owner_user_id: Option<String>,
pub profile_id: Option<String>,
pub owner_user_id: Option::<String>,
pub profile_id: Option::<String>,
pub created_at_micros: i64,
pub updated_at_micros: i64,
}
impl __sdk::InModule for AssetEntityBindingSnapshot {
type Module = super::RemoteModule;
}

View File

@@ -2,8 +2,13 @@
// WILL NOT BE SAVED. MODIFY TABLES IN YOUR MODULE SOURCE CODE INSTEAD.
#![allow(unused, clippy::all)]
use spacetimedb_sdk::__codegen::{
self as __sdk,
__lib,
__sats,
__ws,
};
use super::asset_entity_binding_type::AssetEntityBinding;
use spacetimedb_sdk::__codegen::{self as __sdk, __lib, __sats, __ws};
/// Table handle for the table `asset_entity_binding`.
///
@@ -31,9 +36,7 @@ pub trait AssetEntityBindingTableAccess {
impl AssetEntityBindingTableAccess for super::RemoteTables {
fn asset_entity_binding(&self) -> AssetEntityBindingTableHandle<'_> {
AssetEntityBindingTableHandle {
imp: self
.imp
.get_table::<AssetEntityBinding>("asset_entity_binding"),
imp: self.imp.get_table::<AssetEntityBinding>("asset_entity_binding"),
ctx: std::marker::PhantomData,
}
}
@@ -46,12 +49,8 @@ impl<'ctx> __sdk::Table for AssetEntityBindingTableHandle<'ctx> {
type Row = AssetEntityBinding;
type EventContext = super::EventContext;
fn count(&self) -> u64 {
self.imp.count()
}
fn iter(&self) -> impl Iterator<Item = AssetEntityBinding> + '_ {
self.imp.iter()
}
fn count(&self) -> u64 { self.imp.count() }
fn iter(&self) -> impl Iterator<Item = AssetEntityBinding> + '_ { self.imp.iter() }
type InsertCallbackId = AssetEntityBindingInsertCallbackId;
@@ -97,38 +96,39 @@ impl<'ctx> __sdk::TableWithPrimaryKey for AssetEntityBindingTableHandle<'ctx> {
}
}
/// Access to the `binding_id` unique index on the table `asset_entity_binding`,
/// which allows point queries on the field of the same name
/// via the [`AssetEntityBindingBindingIdUnique::find`] method.
///
/// Users are encouraged not to explicitly reference this type,
/// but to directly chain method calls,
/// like `ctx.db.asset_entity_binding().binding_id().find(...)`.
pub struct AssetEntityBindingBindingIdUnique<'ctx> {
imp: __sdk::UniqueConstraintHandle<AssetEntityBinding, String>,
phantom: std::marker::PhantomData<&'ctx super::RemoteTables>,
}
impl<'ctx> AssetEntityBindingTableHandle<'ctx> {
/// Get a handle on the `binding_id` unique index on the table `asset_entity_binding`.
pub fn binding_id(&self) -> AssetEntityBindingBindingIdUnique<'ctx> {
AssetEntityBindingBindingIdUnique {
imp: self.imp.get_unique_constraint::<String>("binding_id"),
phantom: std::marker::PhantomData,
/// Access to the `binding_id` unique index on the table `asset_entity_binding`,
/// which allows point queries on the field of the same name
/// via the [`AssetEntityBindingBindingIdUnique::find`] method.
///
/// Users are encouraged not to explicitly reference this type,
/// but to directly chain method calls,
/// like `ctx.db.asset_entity_binding().binding_id().find(...)`.
pub struct AssetEntityBindingBindingIdUnique<'ctx> {
imp: __sdk::UniqueConstraintHandle<AssetEntityBinding, String>,
phantom: std::marker::PhantomData<&'ctx super::RemoteTables>,
}
}
}
impl<'ctx> AssetEntityBindingBindingIdUnique<'ctx> {
/// Find the subscribed row whose `binding_id` column value is equal to `col_val`,
/// if such a row is present in the client cache.
pub fn find(&self, col_val: &String) -> Option<AssetEntityBinding> {
self.imp.find(col_val)
}
}
impl<'ctx> AssetEntityBindingTableHandle<'ctx> {
/// Get a handle on the `binding_id` unique index on the table `asset_entity_binding`.
pub fn binding_id(&self) -> AssetEntityBindingBindingIdUnique<'ctx> {
AssetEntityBindingBindingIdUnique {
imp: self.imp.get_unique_constraint::<String>("binding_id"),
phantom: std::marker::PhantomData,
}
}
}
impl<'ctx> AssetEntityBindingBindingIdUnique<'ctx> {
/// Find the subscribed row whose `binding_id` column value is equal to `col_val`,
/// if such a row is present in the client cache.
pub fn find(&self, col_val: &String) -> Option<AssetEntityBinding> {
self.imp.find(col_val)
}
}
#[doc(hidden)]
pub(super) fn register_table(client_cache: &mut __sdk::ClientCache<super::RemoteModule>) {
let _table = client_cache.get_or_make_table::<AssetEntityBinding>("asset_entity_binding");
_table.add_unique_constraint::<String>("binding_id", |row| &row.binding_id);
}
@@ -138,24 +138,26 @@ pub(super) fn parse_table_update(
raw_updates: __ws::v2::TableUpdate,
) -> __sdk::Result<__sdk::TableUpdate<AssetEntityBinding>> {
__sdk::TableUpdate::parse_table_update(raw_updates).map_err(|e| {
__sdk::InternalError::failed_parse("TableUpdate<AssetEntityBinding>", "TableUpdate")
.with_cause(e)
.into()
__sdk::InternalError::failed_parse(
"TableUpdate<AssetEntityBinding>",
"TableUpdate",
).with_cause(e).into()
})
}
#[allow(non_camel_case_types)]
/// Extension trait for query builder access to the table `AssetEntityBinding`.
///
/// Implemented for [`__sdk::QueryTableAccessor`].
pub trait asset_entity_bindingQueryTableAccess {
#[allow(non_snake_case)]
/// Get a query builder for the table `AssetEntityBinding`.
fn asset_entity_binding(&self) -> __sdk::__query_builder::Table<AssetEntityBinding>;
}
#[allow(non_camel_case_types)]
/// Extension trait for query builder access to the table `AssetEntityBinding`.
///
/// Implemented for [`__sdk::QueryTableAccessor`].
pub trait asset_entity_bindingQueryTableAccess {
#[allow(non_snake_case)]
/// Get a query builder for the table `AssetEntityBinding`.
fn asset_entity_binding(&self) -> __sdk::__query_builder::Table<AssetEntityBinding>;
}
impl asset_entity_bindingQueryTableAccess for __sdk::QueryTableAccessor {
fn asset_entity_binding(&self) -> __sdk::__query_builder::Table<AssetEntityBinding> {
__sdk::__query_builder::Table::new("asset_entity_binding")
}
}
impl asset_entity_bindingQueryTableAccess for __sdk::QueryTableAccessor {
fn asset_entity_binding(&self) -> __sdk::__query_builder::Table<AssetEntityBinding> {
__sdk::__query_builder::Table::new("asset_entity_binding")
}
}

View File

@@ -2,7 +2,13 @@
// WILL NOT BE SAVED. MODIFY TABLES IN YOUR MODULE SOURCE CODE INSTEAD.
#![allow(unused, clippy::all)]
use spacetimedb_sdk::__codegen::{self as __sdk, __lib, __sats, __ws};
use spacetimedb_sdk::__codegen::{
self as __sdk,
__lib,
__sats,
__ws,
};
#[derive(__lib::ser::Serialize, __lib::de::Deserialize, Clone, PartialEq, Debug)]
#[sats(crate = __lib)]
@@ -13,16 +19,18 @@ pub struct AssetEntityBinding {
pub entity_id: String,
pub slot: String,
pub asset_kind: String,
pub owner_user_id: Option<String>,
pub profile_id: Option<String>,
pub owner_user_id: Option::<String>,
pub profile_id: Option::<String>,
pub created_at: __sdk::Timestamp,
pub updated_at: __sdk::Timestamp,
}
impl __sdk::InModule for AssetEntityBinding {
type Module = super::RemoteModule;
}
/// Column accessor struct for the table `AssetEntityBinding`.
///
/// Provides typed access to columns for query building.
@@ -33,8 +41,8 @@ pub struct AssetEntityBindingCols {
pub entity_id: __sdk::__query_builder::Col<AssetEntityBinding, String>,
pub slot: __sdk::__query_builder::Col<AssetEntityBinding, String>,
pub asset_kind: __sdk::__query_builder::Col<AssetEntityBinding, String>,
pub owner_user_id: __sdk::__query_builder::Col<AssetEntityBinding, Option<String>>,
pub profile_id: __sdk::__query_builder::Col<AssetEntityBinding, Option<String>>,
pub owner_user_id: __sdk::__query_builder::Col<AssetEntityBinding, Option::<String>>,
pub profile_id: __sdk::__query_builder::Col<AssetEntityBinding, Option::<String>>,
pub created_at: __sdk::__query_builder::Col<AssetEntityBinding, __sdk::Timestamp>,
pub updated_at: __sdk::__query_builder::Col<AssetEntityBinding, __sdk::Timestamp>,
}
@@ -53,6 +61,7 @@ impl __sdk::__query_builder::HasCols for AssetEntityBinding {
profile_id: __sdk::__query_builder::Col::new(table_name, "profile_id"),
created_at: __sdk::__query_builder::Col::new(table_name, "created_at"),
updated_at: __sdk::__query_builder::Col::new(table_name, "updated_at"),
}
}
}
@@ -71,8 +80,10 @@ impl __sdk::__query_builder::HasIxCols for AssetEntityBinding {
AssetEntityBindingIxCols {
asset_object_id: __sdk::__query_builder::IxCol::new(table_name, "asset_object_id"),
binding_id: __sdk::__query_builder::IxCol::new(table_name, "binding_id"),
}
}
}
impl __sdk::__query_builder::CanBeLookupTable for AssetEntityBinding {}

View File

@@ -2,7 +2,12 @@
// WILL NOT BE SAVED. MODIFY TABLES IN YOUR MODULE SOURCE CODE INSTEAD.
#![allow(unused, clippy::all)]
use spacetimedb_sdk::__codegen::{self as __sdk, __lib, __sats, __ws};
use spacetimedb_sdk::__codegen::{
self as __sdk,
__lib,
__sats,
__ws,
};
#[derive(__lib::ser::Serialize, __lib::de::Deserialize, Clone, PartialEq, Debug)]
#[sats(crate = __lib)]
@@ -11,8 +16,12 @@ pub enum AssetObjectAccessPolicy {
Private,
PublicRead,
}
impl __sdk::InModule for AssetObjectAccessPolicy {
type Module = super::RemoteModule;
}

View File

@@ -2,7 +2,12 @@
// WILL NOT BE SAVED. MODIFY TABLES IN YOUR MODULE SOURCE CODE INSTEAD.
#![allow(unused, clippy::all)]
use spacetimedb_sdk::__codegen::{self as __sdk, __lib, __sats, __ws};
use spacetimedb_sdk::__codegen::{
self as __sdk,
__lib,
__sats,
__ws,
};
use super::asset_object_upsert_snapshot_type::AssetObjectUpsertSnapshot;
@@ -10,10 +15,12 @@ use super::asset_object_upsert_snapshot_type::AssetObjectUpsertSnapshot;
#[sats(crate = __lib)]
pub struct AssetObjectProcedureResult {
pub ok: bool,
pub record: Option<AssetObjectUpsertSnapshot>,
pub error_message: Option<String>,
pub record: Option::<AssetObjectUpsertSnapshot>,
pub error_message: Option::<String>,
}
impl __sdk::InModule for AssetObjectProcedureResult {
type Module = super::RemoteModule;
}

View File

@@ -2,9 +2,14 @@
// WILL NOT BE SAVED. MODIFY TABLES IN YOUR MODULE SOURCE CODE INSTEAD.
#![allow(unused, clippy::all)]
use super::asset_object_access_policy_type::AssetObjectAccessPolicy;
use spacetimedb_sdk::__codegen::{
self as __sdk,
__lib,
__sats,
__ws,
};
use super::asset_object_type::AssetObject;
use spacetimedb_sdk::__codegen::{self as __sdk, __lib, __sats, __ws};
use super::asset_object_access_policy_type::AssetObjectAccessPolicy;
/// Table handle for the table `asset_object`.
///
@@ -45,12 +50,8 @@ impl<'ctx> __sdk::Table for AssetObjectTableHandle<'ctx> {
type Row = AssetObject;
type EventContext = super::EventContext;
fn count(&self) -> u64 {
self.imp.count()
}
fn iter(&self) -> impl Iterator<Item = AssetObject> + '_ {
self.imp.iter()
}
fn count(&self) -> u64 { self.imp.count() }
fn iter(&self) -> impl Iterator<Item = AssetObject> + '_ { self.imp.iter() }
type InsertCallbackId = AssetObjectInsertCallbackId;
@@ -96,38 +97,39 @@ impl<'ctx> __sdk::TableWithPrimaryKey for AssetObjectTableHandle<'ctx> {
}
}
/// Access to the `asset_object_id` unique index on the table `asset_object`,
/// which allows point queries on the field of the same name
/// via the [`AssetObjectAssetObjectIdUnique::find`] method.
///
/// Users are encouraged not to explicitly reference this type,
/// but to directly chain method calls,
/// like `ctx.db.asset_object().asset_object_id().find(...)`.
pub struct AssetObjectAssetObjectIdUnique<'ctx> {
imp: __sdk::UniqueConstraintHandle<AssetObject, String>,
phantom: std::marker::PhantomData<&'ctx super::RemoteTables>,
}
impl<'ctx> AssetObjectTableHandle<'ctx> {
/// Get a handle on the `asset_object_id` unique index on the table `asset_object`.
pub fn asset_object_id(&self) -> AssetObjectAssetObjectIdUnique<'ctx> {
AssetObjectAssetObjectIdUnique {
imp: self.imp.get_unique_constraint::<String>("asset_object_id"),
phantom: std::marker::PhantomData,
/// Access to the `asset_object_id` unique index on the table `asset_object`,
/// which allows point queries on the field of the same name
/// via the [`AssetObjectAssetObjectIdUnique::find`] method.
///
/// Users are encouraged not to explicitly reference this type,
/// but to directly chain method calls,
/// like `ctx.db.asset_object().asset_object_id().find(...)`.
pub struct AssetObjectAssetObjectIdUnique<'ctx> {
imp: __sdk::UniqueConstraintHandle<AssetObject, String>,
phantom: std::marker::PhantomData<&'ctx super::RemoteTables>,
}
}
}
impl<'ctx> AssetObjectAssetObjectIdUnique<'ctx> {
/// Find the subscribed row whose `asset_object_id` column value is equal to `col_val`,
/// if such a row is present in the client cache.
pub fn find(&self, col_val: &String) -> Option<AssetObject> {
self.imp.find(col_val)
}
}
impl<'ctx> AssetObjectTableHandle<'ctx> {
/// Get a handle on the `asset_object_id` unique index on the table `asset_object`.
pub fn asset_object_id(&self) -> AssetObjectAssetObjectIdUnique<'ctx> {
AssetObjectAssetObjectIdUnique {
imp: self.imp.get_unique_constraint::<String>("asset_object_id"),
phantom: std::marker::PhantomData,
}
}
}
impl<'ctx> AssetObjectAssetObjectIdUnique<'ctx> {
/// Find the subscribed row whose `asset_object_id` column value is equal to `col_val`,
/// if such a row is present in the client cache.
pub fn find(&self, col_val: &String) -> Option<AssetObject> {
self.imp.find(col_val)
}
}
#[doc(hidden)]
pub(super) fn register_table(client_cache: &mut __sdk::ClientCache<super::RemoteModule>) {
let _table = client_cache.get_or_make_table::<AssetObject>("asset_object");
_table.add_unique_constraint::<String>("asset_object_id", |row| &row.asset_object_id);
}
@@ -137,24 +139,26 @@ pub(super) fn parse_table_update(
raw_updates: __ws::v2::TableUpdate,
) -> __sdk::Result<__sdk::TableUpdate<AssetObject>> {
__sdk::TableUpdate::parse_table_update(raw_updates).map_err(|e| {
__sdk::InternalError::failed_parse("TableUpdate<AssetObject>", "TableUpdate")
.with_cause(e)
.into()
__sdk::InternalError::failed_parse(
"TableUpdate<AssetObject>",
"TableUpdate",
).with_cause(e).into()
})
}
#[allow(non_camel_case_types)]
/// Extension trait for query builder access to the table `AssetObject`.
///
/// Implemented for [`__sdk::QueryTableAccessor`].
pub trait asset_objectQueryTableAccess {
#[allow(non_snake_case)]
/// Get a query builder for the table `AssetObject`.
fn asset_object(&self) -> __sdk::__query_builder::Table<AssetObject>;
}
#[allow(non_camel_case_types)]
/// Extension trait for query builder access to the table `AssetObject`.
///
/// Implemented for [`__sdk::QueryTableAccessor`].
pub trait asset_objectQueryTableAccess {
#[allow(non_snake_case)]
/// Get a query builder for the table `AssetObject`.
fn asset_object(&self) -> __sdk::__query_builder::Table<AssetObject>;
}
impl asset_objectQueryTableAccess for __sdk::QueryTableAccessor {
fn asset_object(&self) -> __sdk::__query_builder::Table<AssetObject> {
__sdk::__query_builder::Table::new("asset_object")
}
}
impl asset_objectQueryTableAccess for __sdk::QueryTableAccessor {
fn asset_object(&self) -> __sdk::__query_builder::Table<AssetObject> {
__sdk::__query_builder::Table::new("asset_object")
}
}

View File

@@ -2,7 +2,12 @@
// WILL NOT BE SAVED. MODIFY TABLES IN YOUR MODULE SOURCE CODE INSTEAD.
#![allow(unused, clippy::all)]
use spacetimedb_sdk::__codegen::{self as __sdk, __lib, __sats, __ws};
use spacetimedb_sdk::__codegen::{
self as __sdk,
__lib,
__sats,
__ws,
};
use super::asset_object_access_policy_type::AssetObjectAccessPolicy;
@@ -13,23 +18,25 @@ pub struct AssetObject {
pub bucket: String,
pub object_key: String,
pub access_policy: AssetObjectAccessPolicy,
pub content_type: Option<String>,
pub content_type: Option::<String>,
pub content_length: u64,
pub content_hash: Option<String>,
pub content_hash: Option::<String>,
pub version: u32,
pub source_job_id: Option<String>,
pub owner_user_id: Option<String>,
pub profile_id: Option<String>,
pub entity_id: Option<String>,
pub source_job_id: Option::<String>,
pub owner_user_id: Option::<String>,
pub profile_id: Option::<String>,
pub entity_id: Option::<String>,
pub asset_kind: String,
pub created_at: __sdk::Timestamp,
pub updated_at: __sdk::Timestamp,
}
impl __sdk::InModule for AssetObject {
type Module = super::RemoteModule;
}
/// Column accessor struct for the table `AssetObject`.
///
/// Provides typed access to columns for query building.
@@ -38,14 +45,14 @@ pub struct AssetObjectCols {
pub bucket: __sdk::__query_builder::Col<AssetObject, String>,
pub object_key: __sdk::__query_builder::Col<AssetObject, String>,
pub access_policy: __sdk::__query_builder::Col<AssetObject, AssetObjectAccessPolicy>,
pub content_type: __sdk::__query_builder::Col<AssetObject, Option<String>>,
pub content_type: __sdk::__query_builder::Col<AssetObject, Option::<String>>,
pub content_length: __sdk::__query_builder::Col<AssetObject, u64>,
pub content_hash: __sdk::__query_builder::Col<AssetObject, Option<String>>,
pub content_hash: __sdk::__query_builder::Col<AssetObject, Option::<String>>,
pub version: __sdk::__query_builder::Col<AssetObject, u32>,
pub source_job_id: __sdk::__query_builder::Col<AssetObject, Option<String>>,
pub owner_user_id: __sdk::__query_builder::Col<AssetObject, Option<String>>,
pub profile_id: __sdk::__query_builder::Col<AssetObject, Option<String>>,
pub entity_id: __sdk::__query_builder::Col<AssetObject, Option<String>>,
pub source_job_id: __sdk::__query_builder::Col<AssetObject, Option::<String>>,
pub owner_user_id: __sdk::__query_builder::Col<AssetObject, Option::<String>>,
pub profile_id: __sdk::__query_builder::Col<AssetObject, Option::<String>>,
pub entity_id: __sdk::__query_builder::Col<AssetObject, Option::<String>>,
pub asset_kind: __sdk::__query_builder::Col<AssetObject, String>,
pub created_at: __sdk::__query_builder::Col<AssetObject, __sdk::Timestamp>,
pub updated_at: __sdk::__query_builder::Col<AssetObject, __sdk::Timestamp>,
@@ -70,6 +77,7 @@ impl __sdk::__query_builder::HasCols for AssetObject {
asset_kind: __sdk::__query_builder::Col::new(table_name, "asset_kind"),
created_at: __sdk::__query_builder::Col::new(table_name, "created_at"),
updated_at: __sdk::__query_builder::Col::new(table_name, "updated_at"),
}
}
}
@@ -88,8 +96,10 @@ impl __sdk::__query_builder::HasIxCols for AssetObject {
AssetObjectIxCols {
asset_kind: __sdk::__query_builder::IxCol::new(table_name, "asset_kind"),
asset_object_id: __sdk::__query_builder::IxCol::new(table_name, "asset_object_id"),
}
}
}
impl __sdk::__query_builder::CanBeLookupTable for AssetObject {}

View File

@@ -2,7 +2,12 @@
// WILL NOT BE SAVED. MODIFY TABLES IN YOUR MODULE SOURCE CODE INSTEAD.
#![allow(unused, clippy::all)]
use spacetimedb_sdk::__codegen::{self as __sdk, __lib, __sats, __ws};
use spacetimedb_sdk::__codegen::{
self as __sdk,
__lib,
__sats,
__ws,
};
use super::asset_object_access_policy_type::AssetObjectAccessPolicy;
@@ -13,18 +18,20 @@ pub struct AssetObjectUpsertInput {
pub bucket: String,
pub object_key: String,
pub access_policy: AssetObjectAccessPolicy,
pub content_type: Option<String>,
pub content_type: Option::<String>,
pub content_length: u64,
pub content_hash: Option<String>,
pub content_hash: Option::<String>,
pub version: u32,
pub source_job_id: Option<String>,
pub owner_user_id: Option<String>,
pub profile_id: Option<String>,
pub entity_id: Option<String>,
pub source_job_id: Option::<String>,
pub owner_user_id: Option::<String>,
pub profile_id: Option::<String>,
pub entity_id: Option::<String>,
pub asset_kind: String,
pub updated_at_micros: i64,
}
impl __sdk::InModule for AssetObjectUpsertInput {
type Module = super::RemoteModule;
}

View File

@@ -2,7 +2,12 @@
// WILL NOT BE SAVED. MODIFY TABLES IN YOUR MODULE SOURCE CODE INSTEAD.
#![allow(unused, clippy::all)]
use spacetimedb_sdk::__codegen::{self as __sdk, __lib, __sats, __ws};
use spacetimedb_sdk::__codegen::{
self as __sdk,
__lib,
__sats,
__ws,
};
use super::asset_object_access_policy_type::AssetObjectAccessPolicy;
@@ -13,19 +18,21 @@ pub struct AssetObjectUpsertSnapshot {
pub bucket: String,
pub object_key: String,
pub access_policy: AssetObjectAccessPolicy,
pub content_type: Option<String>,
pub content_type: Option::<String>,
pub content_length: u64,
pub content_hash: Option<String>,
pub content_hash: Option::<String>,
pub version: u32,
pub source_job_id: Option<String>,
pub owner_user_id: Option<String>,
pub profile_id: Option<String>,
pub entity_id: Option<String>,
pub source_job_id: Option::<String>,
pub owner_user_id: Option::<String>,
pub profile_id: Option::<String>,
pub entity_id: Option::<String>,
pub asset_kind: String,
pub created_at_micros: i64,
pub updated_at_micros: i64,
}
impl __sdk::InModule for AssetObjectUpsertSnapshot {
type Module = super::RemoteModule;
}

View File

@@ -2,17 +2,23 @@
// WILL NOT BE SAVED. MODIFY TABLES IN YOUR MODULE SOURCE CODE INSTEAD.
#![allow(unused, clippy::all)]
use spacetimedb_sdk::__codegen::{self as __sdk, __lib, __sats, __ws};
use spacetimedb_sdk::__codegen::{
self as __sdk,
__lib,
__sats,
__ws,
};
use super::ai_result_reference_input_type::AiResultReferenceInput;
use super::ai_task_procedure_result_type::AiTaskProcedureResult;
use super::ai_result_reference_input_type::AiResultReferenceInput;
#[derive(__lib::ser::Serialize, __lib::de::Deserialize, Clone, PartialEq, Debug)]
#[sats(crate = __lib)]
struct AttachAiResultReferenceAndReturnArgs {
struct AttachAiResultReferenceAndReturnArgs {
pub input: AiResultReferenceInput,
}
impl __sdk::InModule for AttachAiResultReferenceAndReturnArgs {
type Module = super::RemoteModule;
}
@@ -22,19 +28,16 @@ impl __sdk::InModule for AttachAiResultReferenceAndReturnArgs {
///
/// Implemented for [`super::RemoteProcedures`].
pub trait attach_ai_result_reference_and_return {
fn attach_ai_result_reference_and_return(&self, input: AiResultReferenceInput) {
self.attach_ai_result_reference_and_return_then(input, |_, _| {});
fn attach_ai_result_reference_and_return(&self, input: AiResultReferenceInput,
) {
self.attach_ai_result_reference_and_return_then(input, |_, _| {});
}
fn attach_ai_result_reference_and_return_then(
&self,
input: AiResultReferenceInput,
__callback: impl FnOnce(
&super::ProcedureEventContext,
Result<AiTaskProcedureResult, __sdk::InternalError>,
) + Send
+ 'static,
__callback: impl FnOnce(&super::ProcedureEventContext, Result<AiTaskProcedureResult, __sdk::InternalError>) + Send + 'static,
);
}
@@ -43,17 +46,13 @@ impl attach_ai_result_reference_and_return for super::RemoteProcedures {
&self,
input: AiResultReferenceInput,
__callback: impl FnOnce(
&super::ProcedureEventContext,
Result<AiTaskProcedureResult, __sdk::InternalError>,
) + Send
+ 'static,
__callback: impl FnOnce(&super::ProcedureEventContext, Result<AiTaskProcedureResult, __sdk::InternalError>) + Send + 'static,
) {
self.imp
.invoke_procedure_with_callback::<_, AiTaskProcedureResult>(
"attach_ai_result_reference_and_return",
AttachAiResultReferenceAndReturnArgs { input },
__callback,
);
self.imp.invoke_procedure_with_callback::<_, AiTaskProcedureResult>(
"attach_ai_result_reference_and_return",
AttachAiResultReferenceAndReturnArgs { input, },
__callback,
);
}
}

View File

@@ -2,7 +2,12 @@
// WILL NOT BE SAVED. MODIFY TABLES IN YOUR MODULE SOURCE CODE INSTEAD.
#![allow(unused, clippy::all)]
use spacetimedb_sdk::__codegen::{self as __sdk, __lib, __sats, __ws};
use spacetimedb_sdk::__codegen::{
self as __sdk,
__lib,
__sats,
__ws,
};
#[derive(__lib::ser::Serialize, __lib::de::Deserialize, Clone, PartialEq, Debug)]
#[sats(crate = __lib)]
@@ -11,8 +16,12 @@ pub enum BattleMode {
Fight,
Spar,
}
impl __sdk::InModule for BattleMode {
type Module = super::RemoteModule;
}

View File

@@ -2,7 +2,12 @@
// WILL NOT BE SAVED. MODIFY TABLES IN YOUR MODULE SOURCE CODE INSTEAD.
#![allow(unused, clippy::all)]
use spacetimedb_sdk::__codegen::{self as __sdk, __lib, __sats, __ws};
use spacetimedb_sdk::__codegen::{
self as __sdk,
__lib,
__sats,
__ws,
};
use super::battle_mode_type::BattleMode;
use super::runtime_item_reward_item_snapshot_type::RuntimeItemRewardItemSnapshot;
@@ -14,7 +19,7 @@ pub struct BattleStateInput {
pub story_session_id: String,
pub runtime_session_id: String,
pub actor_user_id: String,
pub chapter_id: Option<String>,
pub chapter_id: Option::<String>,
pub target_npc_id: String,
pub target_name: String,
pub battle_mode: BattleMode,
@@ -25,10 +30,12 @@ pub struct BattleStateInput {
pub target_hp: i32,
pub target_max_hp: i32,
pub experience_reward: u32,
pub reward_items: Vec<RuntimeItemRewardItemSnapshot>,
pub reward_items: Vec::<RuntimeItemRewardItemSnapshot>,
pub created_at_micros: i64,
}
impl __sdk::InModule for BattleStateInput {
type Module = super::RemoteModule;
}

View File

@@ -2,7 +2,12 @@
// WILL NOT BE SAVED. MODIFY TABLES IN YOUR MODULE SOURCE CODE INSTEAD.
#![allow(unused, clippy::all)]
use spacetimedb_sdk::__codegen::{self as __sdk, __lib, __sats, __ws};
use spacetimedb_sdk::__codegen::{
self as __sdk,
__lib,
__sats,
__ws,
};
use super::battle_state_snapshot_type::BattleStateSnapshot;
@@ -10,10 +15,12 @@ use super::battle_state_snapshot_type::BattleStateSnapshot;
#[sats(crate = __lib)]
pub struct BattleStateProcedureResult {
pub ok: bool,
pub snapshot: Option<BattleStateSnapshot>,
pub error_message: Option<String>,
pub snapshot: Option::<BattleStateSnapshot>,
pub error_message: Option::<String>,
}
impl __sdk::InModule for BattleStateProcedureResult {
type Module = super::RemoteModule;
}

View File

@@ -2,7 +2,13 @@
// WILL NOT BE SAVED. MODIFY TABLES IN YOUR MODULE SOURCE CODE INSTEAD.
#![allow(unused, clippy::all)]
use spacetimedb_sdk::__codegen::{self as __sdk, __lib, __sats, __ws};
use spacetimedb_sdk::__codegen::{
self as __sdk,
__lib,
__sats,
__ws,
};
#[derive(__lib::ser::Serialize, __lib::de::Deserialize, Clone, PartialEq, Debug)]
#[sats(crate = __lib)]
@@ -10,6 +16,8 @@ pub struct BattleStateQueryInput {
pub battle_state_id: String,
}
impl __sdk::InModule for BattleStateQueryInput {
type Module = super::RemoteModule;
}

View File

@@ -2,12 +2,17 @@
// WILL NOT BE SAVED. MODIFY TABLES IN YOUR MODULE SOURCE CODE INSTEAD.
#![allow(unused, clippy::all)]
use spacetimedb_sdk::__codegen::{self as __sdk, __lib, __sats, __ws};
use spacetimedb_sdk::__codegen::{
self as __sdk,
__lib,
__sats,
__ws,
};
use super::battle_mode_type::BattleMode;
use super::battle_status_type::BattleStatus;
use super::combat_outcome_type::CombatOutcome;
use super::runtime_item_reward_item_snapshot_type::RuntimeItemRewardItemSnapshot;
use super::combat_outcome_type::CombatOutcome;
#[derive(__lib::ser::Serialize, __lib::de::Deserialize, Clone, PartialEq, Debug)]
#[sats(crate = __lib)]
@@ -16,7 +21,7 @@ pub struct BattleStateSnapshot {
pub story_session_id: String,
pub runtime_session_id: String,
pub actor_user_id: String,
pub chapter_id: Option<String>,
pub chapter_id: Option::<String>,
pub target_npc_id: String,
pub target_name: String,
pub battle_mode: BattleMode,
@@ -28,11 +33,11 @@ pub struct BattleStateSnapshot {
pub target_hp: i32,
pub target_max_hp: i32,
pub experience_reward: u32,
pub reward_items: Vec<RuntimeItemRewardItemSnapshot>,
pub reward_items: Vec::<RuntimeItemRewardItemSnapshot>,
pub turn_index: u32,
pub last_action_function_id: Option<String>,
pub last_action_text: Option<String>,
pub last_result_text: Option<String>,
pub last_action_function_id: Option::<String>,
pub last_action_text: Option::<String>,
pub last_result_text: Option::<String>,
pub last_damage_dealt: i32,
pub last_damage_taken: i32,
pub last_outcome: CombatOutcome,
@@ -41,6 +46,8 @@ pub struct BattleStateSnapshot {
pub updated_at_micros: i64,
}
impl __sdk::InModule for BattleStateSnapshot {
type Module = super::RemoteModule;
}

View File

@@ -2,12 +2,17 @@
// WILL NOT BE SAVED. MODIFY TABLES IN YOUR MODULE SOURCE CODE INSTEAD.
#![allow(unused, clippy::all)]
use super::battle_mode_type::BattleMode;
use spacetimedb_sdk::__codegen::{
self as __sdk,
__lib,
__sats,
__ws,
};
use super::battle_state_type::BattleState;
use super::battle_mode_type::BattleMode;
use super::battle_status_type::BattleStatus;
use super::combat_outcome_type::CombatOutcome;
use super::runtime_item_reward_item_snapshot_type::RuntimeItemRewardItemSnapshot;
use spacetimedb_sdk::__codegen::{self as __sdk, __lib, __sats, __ws};
use super::combat_outcome_type::CombatOutcome;
/// Table handle for the table `battle_state`.
///
@@ -48,12 +53,8 @@ impl<'ctx> __sdk::Table for BattleStateTableHandle<'ctx> {
type Row = BattleState;
type EventContext = super::EventContext;
fn count(&self) -> u64 {
self.imp.count()
}
fn iter(&self) -> impl Iterator<Item = BattleState> + '_ {
self.imp.iter()
}
fn count(&self) -> u64 { self.imp.count() }
fn iter(&self) -> impl Iterator<Item = BattleState> + '_ { self.imp.iter() }
type InsertCallbackId = BattleStateInsertCallbackId;
@@ -99,38 +100,39 @@ impl<'ctx> __sdk::TableWithPrimaryKey for BattleStateTableHandle<'ctx> {
}
}
/// Access to the `battle_state_id` unique index on the table `battle_state`,
/// which allows point queries on the field of the same name
/// via the [`BattleStateBattleStateIdUnique::find`] method.
///
/// Users are encouraged not to explicitly reference this type,
/// but to directly chain method calls,
/// like `ctx.db.battle_state().battle_state_id().find(...)`.
pub struct BattleStateBattleStateIdUnique<'ctx> {
imp: __sdk::UniqueConstraintHandle<BattleState, String>,
phantom: std::marker::PhantomData<&'ctx super::RemoteTables>,
}
impl<'ctx> BattleStateTableHandle<'ctx> {
/// Get a handle on the `battle_state_id` unique index on the table `battle_state`.
pub fn battle_state_id(&self) -> BattleStateBattleStateIdUnique<'ctx> {
BattleStateBattleStateIdUnique {
imp: self.imp.get_unique_constraint::<String>("battle_state_id"),
phantom: std::marker::PhantomData,
/// Access to the `battle_state_id` unique index on the table `battle_state`,
/// which allows point queries on the field of the same name
/// via the [`BattleStateBattleStateIdUnique::find`] method.
///
/// Users are encouraged not to explicitly reference this type,
/// but to directly chain method calls,
/// like `ctx.db.battle_state().battle_state_id().find(...)`.
pub struct BattleStateBattleStateIdUnique<'ctx> {
imp: __sdk::UniqueConstraintHandle<BattleState, String>,
phantom: std::marker::PhantomData<&'ctx super::RemoteTables>,
}
}
}
impl<'ctx> BattleStateBattleStateIdUnique<'ctx> {
/// Find the subscribed row whose `battle_state_id` column value is equal to `col_val`,
/// if such a row is present in the client cache.
pub fn find(&self, col_val: &String) -> Option<BattleState> {
self.imp.find(col_val)
}
}
impl<'ctx> BattleStateTableHandle<'ctx> {
/// Get a handle on the `battle_state_id` unique index on the table `battle_state`.
pub fn battle_state_id(&self) -> BattleStateBattleStateIdUnique<'ctx> {
BattleStateBattleStateIdUnique {
imp: self.imp.get_unique_constraint::<String>("battle_state_id"),
phantom: std::marker::PhantomData,
}
}
}
impl<'ctx> BattleStateBattleStateIdUnique<'ctx> {
/// Find the subscribed row whose `battle_state_id` column value is equal to `col_val`,
/// if such a row is present in the client cache.
pub fn find(&self, col_val: &String) -> Option<BattleState> {
self.imp.find(col_val)
}
}
#[doc(hidden)]
pub(super) fn register_table(client_cache: &mut __sdk::ClientCache<super::RemoteModule>) {
let _table = client_cache.get_or_make_table::<BattleState>("battle_state");
_table.add_unique_constraint::<String>("battle_state_id", |row| &row.battle_state_id);
}
@@ -140,24 +142,26 @@ pub(super) fn parse_table_update(
raw_updates: __ws::v2::TableUpdate,
) -> __sdk::Result<__sdk::TableUpdate<BattleState>> {
__sdk::TableUpdate::parse_table_update(raw_updates).map_err(|e| {
__sdk::InternalError::failed_parse("TableUpdate<BattleState>", "TableUpdate")
.with_cause(e)
.into()
__sdk::InternalError::failed_parse(
"TableUpdate<BattleState>",
"TableUpdate",
).with_cause(e).into()
})
}
#[allow(non_camel_case_types)]
/// Extension trait for query builder access to the table `BattleState`.
///
/// Implemented for [`__sdk::QueryTableAccessor`].
pub trait battle_stateQueryTableAccess {
#[allow(non_snake_case)]
/// Get a query builder for the table `BattleState`.
fn battle_state(&self) -> __sdk::__query_builder::Table<BattleState>;
}
#[allow(non_camel_case_types)]
/// Extension trait for query builder access to the table `BattleState`.
///
/// Implemented for [`__sdk::QueryTableAccessor`].
pub trait battle_stateQueryTableAccess {
#[allow(non_snake_case)]
/// Get a query builder for the table `BattleState`.
fn battle_state(&self) -> __sdk::__query_builder::Table<BattleState>;
}
impl battle_stateQueryTableAccess for __sdk::QueryTableAccessor {
fn battle_state(&self) -> __sdk::__query_builder::Table<BattleState> {
__sdk::__query_builder::Table::new("battle_state")
}
}
impl battle_stateQueryTableAccess for __sdk::QueryTableAccessor {
fn battle_state(&self) -> __sdk::__query_builder::Table<BattleState> {
__sdk::__query_builder::Table::new("battle_state")
}
}

View File

@@ -2,12 +2,17 @@
// WILL NOT BE SAVED. MODIFY TABLES IN YOUR MODULE SOURCE CODE INSTEAD.
#![allow(unused, clippy::all)]
use spacetimedb_sdk::__codegen::{self as __sdk, __lib, __sats, __ws};
use spacetimedb_sdk::__codegen::{
self as __sdk,
__lib,
__sats,
__ws,
};
use super::battle_mode_type::BattleMode;
use super::battle_status_type::BattleStatus;
use super::combat_outcome_type::CombatOutcome;
use super::runtime_item_reward_item_snapshot_type::RuntimeItemRewardItemSnapshot;
use super::combat_outcome_type::CombatOutcome;
#[derive(__lib::ser::Serialize, __lib::de::Deserialize, Clone, PartialEq, Debug)]
#[sats(crate = __lib)]
@@ -16,7 +21,7 @@ pub struct BattleState {
pub story_session_id: String,
pub runtime_session_id: String,
pub actor_user_id: String,
pub chapter_id: Option<String>,
pub chapter_id: Option::<String>,
pub target_npc_id: String,
pub target_name: String,
pub battle_mode: BattleMode,
@@ -28,11 +33,11 @@ pub struct BattleState {
pub target_hp: i32,
pub target_max_hp: i32,
pub experience_reward: u32,
pub reward_items: Vec<RuntimeItemRewardItemSnapshot>,
pub reward_items: Vec::<RuntimeItemRewardItemSnapshot>,
pub turn_index: u32,
pub last_action_function_id: Option<String>,
pub last_action_text: Option<String>,
pub last_result_text: Option<String>,
pub last_action_function_id: Option::<String>,
pub last_action_text: Option::<String>,
pub last_result_text: Option::<String>,
pub last_damage_dealt: i32,
pub last_damage_taken: i32,
pub last_outcome: CombatOutcome,
@@ -41,10 +46,12 @@ pub struct BattleState {
pub updated_at: __sdk::Timestamp,
}
impl __sdk::InModule for BattleState {
type Module = super::RemoteModule;
}
/// Column accessor struct for the table `BattleState`.
///
/// Provides typed access to columns for query building.
@@ -53,7 +60,7 @@ pub struct BattleStateCols {
pub story_session_id: __sdk::__query_builder::Col<BattleState, String>,
pub runtime_session_id: __sdk::__query_builder::Col<BattleState, String>,
pub actor_user_id: __sdk::__query_builder::Col<BattleState, String>,
pub chapter_id: __sdk::__query_builder::Col<BattleState, Option<String>>,
pub chapter_id: __sdk::__query_builder::Col<BattleState, Option::<String>>,
pub target_npc_id: __sdk::__query_builder::Col<BattleState, String>,
pub target_name: __sdk::__query_builder::Col<BattleState, String>,
pub battle_mode: __sdk::__query_builder::Col<BattleState, BattleMode>,
@@ -65,11 +72,11 @@ pub struct BattleStateCols {
pub target_hp: __sdk::__query_builder::Col<BattleState, i32>,
pub target_max_hp: __sdk::__query_builder::Col<BattleState, i32>,
pub experience_reward: __sdk::__query_builder::Col<BattleState, u32>,
pub reward_items: __sdk::__query_builder::Col<BattleState, Vec<RuntimeItemRewardItemSnapshot>>,
pub reward_items: __sdk::__query_builder::Col<BattleState, Vec::<RuntimeItemRewardItemSnapshot>>,
pub turn_index: __sdk::__query_builder::Col<BattleState, u32>,
pub last_action_function_id: __sdk::__query_builder::Col<BattleState, Option<String>>,
pub last_action_text: __sdk::__query_builder::Col<BattleState, Option<String>>,
pub last_result_text: __sdk::__query_builder::Col<BattleState, Option<String>>,
pub last_action_function_id: __sdk::__query_builder::Col<BattleState, Option::<String>>,
pub last_action_text: __sdk::__query_builder::Col<BattleState, Option::<String>>,
pub last_result_text: __sdk::__query_builder::Col<BattleState, Option::<String>>,
pub last_damage_dealt: __sdk::__query_builder::Col<BattleState, i32>,
pub last_damage_taken: __sdk::__query_builder::Col<BattleState, i32>,
pub last_outcome: __sdk::__query_builder::Col<BattleState, CombatOutcome>,
@@ -100,10 +107,7 @@ impl __sdk::__query_builder::HasCols for BattleState {
experience_reward: __sdk::__query_builder::Col::new(table_name, "experience_reward"),
reward_items: __sdk::__query_builder::Col::new(table_name, "reward_items"),
turn_index: __sdk::__query_builder::Col::new(table_name, "turn_index"),
last_action_function_id: __sdk::__query_builder::Col::new(
table_name,
"last_action_function_id",
),
last_action_function_id: __sdk::__query_builder::Col::new(table_name, "last_action_function_id"),
last_action_text: __sdk::__query_builder::Col::new(table_name, "last_action_text"),
last_result_text: __sdk::__query_builder::Col::new(table_name, "last_result_text"),
last_damage_dealt: __sdk::__query_builder::Col::new(table_name, "last_damage_dealt"),
@@ -112,6 +116,7 @@ impl __sdk::__query_builder::HasCols for BattleState {
version: __sdk::__query_builder::Col::new(table_name, "version"),
created_at: __sdk::__query_builder::Col::new(table_name, "created_at"),
updated_at: __sdk::__query_builder::Col::new(table_name, "updated_at"),
}
}
}
@@ -132,13 +137,12 @@ impl __sdk::__query_builder::HasIxCols for BattleState {
BattleStateIxCols {
actor_user_id: __sdk::__query_builder::IxCol::new(table_name, "actor_user_id"),
battle_state_id: __sdk::__query_builder::IxCol::new(table_name, "battle_state_id"),
runtime_session_id: __sdk::__query_builder::IxCol::new(
table_name,
"runtime_session_id",
),
runtime_session_id: __sdk::__query_builder::IxCol::new(table_name, "runtime_session_id"),
story_session_id: __sdk::__query_builder::IxCol::new(table_name, "story_session_id"),
}
}
}
impl __sdk::__query_builder::CanBeLookupTable for BattleState {}

View File

@@ -2,7 +2,12 @@
// WILL NOT BE SAVED. MODIFY TABLES IN YOUR MODULE SOURCE CODE INSTEAD.
#![allow(unused, clippy::all)]
use spacetimedb_sdk::__codegen::{self as __sdk, __lib, __sats, __ws};
use spacetimedb_sdk::__codegen::{
self as __sdk,
__lib,
__sats,
__ws,
};
#[derive(__lib::ser::Serialize, __lib::de::Deserialize, Clone, PartialEq, Debug)]
#[sats(crate = __lib)]
@@ -13,8 +18,12 @@ pub enum BattleStatus {
Resolved,
Aborted,
}
impl __sdk::InModule for BattleStatus {
type Module = super::RemoteModule;
}

View File

@@ -2,17 +2,23 @@
// WILL NOT BE SAVED. MODIFY TABLES IN YOUR MODULE SOURCE CODE INSTEAD.
#![allow(unused, clippy::all)]
use spacetimedb_sdk::__codegen::{self as __sdk, __lib, __sats, __ws};
use spacetimedb_sdk::__codegen::{
self as __sdk,
__lib,
__sats,
__ws,
};
use super::story_session_input_type::StorySessionInput;
use super::story_session_procedure_result_type::StorySessionProcedureResult;
#[derive(__lib::ser::Serialize, __lib::de::Deserialize, Clone, PartialEq, Debug)]
#[sats(crate = __lib)]
struct BeginStorySessionAndReturnArgs {
struct BeginStorySessionAndReturnArgs {
pub input: StorySessionInput,
}
impl __sdk::InModule for BeginStorySessionAndReturnArgs {
type Module = super::RemoteModule;
}
@@ -22,19 +28,16 @@ impl __sdk::InModule for BeginStorySessionAndReturnArgs {
///
/// Implemented for [`super::RemoteProcedures`].
pub trait begin_story_session_and_return {
fn begin_story_session_and_return(&self, input: StorySessionInput) {
self.begin_story_session_and_return_then(input, |_, _| {});
fn begin_story_session_and_return(&self, input: StorySessionInput,
) {
self.begin_story_session_and_return_then(input, |_, _| {});
}
fn begin_story_session_and_return_then(
&self,
input: StorySessionInput,
__callback: impl FnOnce(
&super::ProcedureEventContext,
Result<StorySessionProcedureResult, __sdk::InternalError>,
) + Send
+ 'static,
__callback: impl FnOnce(&super::ProcedureEventContext, Result<StorySessionProcedureResult, __sdk::InternalError>) + Send + 'static,
);
}
@@ -43,17 +46,13 @@ impl begin_story_session_and_return for super::RemoteProcedures {
&self,
input: StorySessionInput,
__callback: impl FnOnce(
&super::ProcedureEventContext,
Result<StorySessionProcedureResult, __sdk::InternalError>,
) + Send
+ 'static,
__callback: impl FnOnce(&super::ProcedureEventContext, Result<StorySessionProcedureResult, __sdk::InternalError>) + Send + 'static,
) {
self.imp
.invoke_procedure_with_callback::<_, StorySessionProcedureResult>(
"begin_story_session_and_return",
BeginStorySessionAndReturnArgs { input },
__callback,
);
self.imp.invoke_procedure_with_callback::<_, StorySessionProcedureResult>(
"begin_story_session_and_return",
BeginStorySessionAndReturnArgs { input, },
__callback,
);
}
}

View File

@@ -2,7 +2,12 @@
// WILL NOT BE SAVED. MODIFY TABLES IN YOUR MODULE SOURCE CODE INSTEAD.
#![allow(unused, clippy::all)]
use spacetimedb_sdk::__codegen::{self as __sdk, __lib, __sats, __ws};
use spacetimedb_sdk::__codegen::{
self as __sdk,
__lib,
__sats,
__ws,
};
use super::story_session_input_type::StorySessionInput;
@@ -14,8 +19,10 @@ pub(super) struct BeginStorySessionArgs {
impl From<BeginStorySessionArgs> for super::Reducer {
fn from(args: BeginStorySessionArgs) -> Self {
Self::BeginStorySession { input: args.input }
}
Self::BeginStorySession {
input: args.input,
}
}
}
impl __sdk::InModule for BeginStorySessionArgs {
@@ -33,8 +40,9 @@ pub trait begin_story_session {
/// The reducer will run asynchronously in the future,
/// and this method provides no way to listen for its completion status.
/// /// Use [`begin_story_session:begin_story_session_then`] to run a callback after the reducer completes.
fn begin_story_session(&self, input: StorySessionInput) -> __sdk::Result<()> {
self.begin_story_session_then(input, |_, _| {})
fn begin_story_session(&self, input: StorySessionInput,
) -> __sdk::Result<()> {
self.begin_story_session_then(input, |_, _| {})
}
/// Request that the remote module invoke the reducer `begin_story_session` to run as soon as possible,
@@ -47,11 +55,9 @@ pub trait begin_story_session {
&self,
input: StorySessionInput,
callback: impl FnOnce(
&super::ReducerEventContext,
Result<Result<(), String>, __sdk::InternalError>,
) + Send
+ 'static,
callback: impl FnOnce(&super::ReducerEventContext, Result<Result<(), String>, __sdk::InternalError>)
+ Send
+ 'static,
) -> __sdk::Result<()>;
}
@@ -60,13 +66,11 @@ impl begin_story_session for super::RemoteReducers {
&self,
input: StorySessionInput,
callback: impl FnOnce(
&super::ReducerEventContext,
Result<Result<(), String>, __sdk::InternalError>,
) + Send
+ 'static,
callback: impl FnOnce(&super::ReducerEventContext, Result<Result<(), String>, __sdk::InternalError>)
+ Send
+ 'static,
) -> __sdk::Result<()> {
self.imp
.invoke_reducer_with_callback(BeginStorySessionArgs { input }, callback)
self.imp.invoke_reducer_with_callback(BeginStorySessionArgs { input, }, callback)
}
}

View File

@@ -2,7 +2,12 @@
// WILL NOT BE SAVED. MODIFY TABLES IN YOUR MODULE SOURCE CODE INSTEAD.
#![allow(unused, clippy::all)]
use spacetimedb_sdk::__codegen::{self as __sdk, __lib, __sats, __ws};
use spacetimedb_sdk::__codegen::{
self as __sdk,
__lib,
__sats,
__ws,
};
#[derive(__lib::ser::Serialize, __lib::de::Deserialize, Clone, PartialEq, Debug)]
#[sats(crate = __lib)]
@@ -15,8 +20,12 @@ pub enum BigFishAgentMessageKind {
ActionResult,
Warning,
}
impl __sdk::InModule for BigFishAgentMessageKind {
type Module = super::RemoteModule;
}

View File

@@ -2,7 +2,12 @@
// WILL NOT BE SAVED. MODIFY TABLES IN YOUR MODULE SOURCE CODE INSTEAD.
#![allow(unused, clippy::all)]
use spacetimedb_sdk::__codegen::{self as __sdk, __lib, __sats, __ws};
use spacetimedb_sdk::__codegen::{
self as __sdk,
__lib,
__sats,
__ws,
};
#[derive(__lib::ser::Serialize, __lib::de::Deserialize, Clone, PartialEq, Debug)]
#[sats(crate = __lib)]
@@ -13,8 +18,12 @@ pub enum BigFishAgentMessageRole {
Assistant,
System,
}
impl __sdk::InModule for BigFishAgentMessageRole {
type Module = super::RemoteModule;
}

View File

@@ -2,10 +2,15 @@
// WILL NOT BE SAVED. MODIFY TABLES IN YOUR MODULE SOURCE CODE INSTEAD.
#![allow(unused, clippy::all)]
use spacetimedb_sdk::__codegen::{self as __sdk, __lib, __sats, __ws};
use spacetimedb_sdk::__codegen::{
self as __sdk,
__lib,
__sats,
__ws,
};
use super::big_fish_agent_message_kind_type::BigFishAgentMessageKind;
use super::big_fish_agent_message_role_type::BigFishAgentMessageRole;
use super::big_fish_agent_message_kind_type::BigFishAgentMessageKind;
#[derive(__lib::ser::Serialize, __lib::de::Deserialize, Clone, PartialEq, Debug)]
#[sats(crate = __lib)]
@@ -18,6 +23,8 @@ pub struct BigFishAgentMessageSnapshot {
pub created_at_micros: i64,
}
impl __sdk::InModule for BigFishAgentMessageSnapshot {
type Module = super::RemoteModule;
}

View File

@@ -2,10 +2,15 @@
// WILL NOT BE SAVED. MODIFY TABLES IN YOUR MODULE SOURCE CODE INSTEAD.
#![allow(unused, clippy::all)]
use super::big_fish_agent_message_kind_type::BigFishAgentMessageKind;
use super::big_fish_agent_message_role_type::BigFishAgentMessageRole;
use spacetimedb_sdk::__codegen::{
self as __sdk,
__lib,
__sats,
__ws,
};
use super::big_fish_agent_message_type::BigFishAgentMessage;
use spacetimedb_sdk::__codegen::{self as __sdk, __lib, __sats, __ws};
use super::big_fish_agent_message_role_type::BigFishAgentMessageRole;
use super::big_fish_agent_message_kind_type::BigFishAgentMessageKind;
/// Table handle for the table `big_fish_agent_message`.
///
@@ -33,9 +38,7 @@ pub trait BigFishAgentMessageTableAccess {
impl BigFishAgentMessageTableAccess for super::RemoteTables {
fn big_fish_agent_message(&self) -> BigFishAgentMessageTableHandle<'_> {
BigFishAgentMessageTableHandle {
imp: self
.imp
.get_table::<BigFishAgentMessage>("big_fish_agent_message"),
imp: self.imp.get_table::<BigFishAgentMessage>("big_fish_agent_message"),
ctx: std::marker::PhantomData,
}
}
@@ -48,12 +51,8 @@ impl<'ctx> __sdk::Table for BigFishAgentMessageTableHandle<'ctx> {
type Row = BigFishAgentMessage;
type EventContext = super::EventContext;
fn count(&self) -> u64 {
self.imp.count()
}
fn iter(&self) -> impl Iterator<Item = BigFishAgentMessage> + '_ {
self.imp.iter()
}
fn count(&self) -> u64 { self.imp.count() }
fn iter(&self) -> impl Iterator<Item = BigFishAgentMessage> + '_ { self.imp.iter() }
type InsertCallbackId = BigFishAgentMessageInsertCallbackId;
@@ -99,38 +98,39 @@ impl<'ctx> __sdk::TableWithPrimaryKey for BigFishAgentMessageTableHandle<'ctx> {
}
}
/// Access to the `message_id` unique index on the table `big_fish_agent_message`,
/// which allows point queries on the field of the same name
/// via the [`BigFishAgentMessageMessageIdUnique::find`] method.
///
/// Users are encouraged not to explicitly reference this type,
/// but to directly chain method calls,
/// like `ctx.db.big_fish_agent_message().message_id().find(...)`.
pub struct BigFishAgentMessageMessageIdUnique<'ctx> {
imp: __sdk::UniqueConstraintHandle<BigFishAgentMessage, String>,
phantom: std::marker::PhantomData<&'ctx super::RemoteTables>,
}
impl<'ctx> BigFishAgentMessageTableHandle<'ctx> {
/// Get a handle on the `message_id` unique index on the table `big_fish_agent_message`.
pub fn message_id(&self) -> BigFishAgentMessageMessageIdUnique<'ctx> {
BigFishAgentMessageMessageIdUnique {
imp: self.imp.get_unique_constraint::<String>("message_id"),
phantom: std::marker::PhantomData,
/// Access to the `message_id` unique index on the table `big_fish_agent_message`,
/// which allows point queries on the field of the same name
/// via the [`BigFishAgentMessageMessageIdUnique::find`] method.
///
/// Users are encouraged not to explicitly reference this type,
/// but to directly chain method calls,
/// like `ctx.db.big_fish_agent_message().message_id().find(...)`.
pub struct BigFishAgentMessageMessageIdUnique<'ctx> {
imp: __sdk::UniqueConstraintHandle<BigFishAgentMessage, String>,
phantom: std::marker::PhantomData<&'ctx super::RemoteTables>,
}
}
}
impl<'ctx> BigFishAgentMessageMessageIdUnique<'ctx> {
/// Find the subscribed row whose `message_id` column value is equal to `col_val`,
/// if such a row is present in the client cache.
pub fn find(&self, col_val: &String) -> Option<BigFishAgentMessage> {
self.imp.find(col_val)
}
}
impl<'ctx> BigFishAgentMessageTableHandle<'ctx> {
/// Get a handle on the `message_id` unique index on the table `big_fish_agent_message`.
pub fn message_id(&self) -> BigFishAgentMessageMessageIdUnique<'ctx> {
BigFishAgentMessageMessageIdUnique {
imp: self.imp.get_unique_constraint::<String>("message_id"),
phantom: std::marker::PhantomData,
}
}
}
impl<'ctx> BigFishAgentMessageMessageIdUnique<'ctx> {
/// Find the subscribed row whose `message_id` column value is equal to `col_val`,
/// if such a row is present in the client cache.
pub fn find(&self, col_val: &String) -> Option<BigFishAgentMessage> {
self.imp.find(col_val)
}
}
#[doc(hidden)]
pub(super) fn register_table(client_cache: &mut __sdk::ClientCache<super::RemoteModule>) {
let _table = client_cache.get_or_make_table::<BigFishAgentMessage>("big_fish_agent_message");
_table.add_unique_constraint::<String>("message_id", |row| &row.message_id);
}
@@ -140,24 +140,26 @@ pub(super) fn parse_table_update(
raw_updates: __ws::v2::TableUpdate,
) -> __sdk::Result<__sdk::TableUpdate<BigFishAgentMessage>> {
__sdk::TableUpdate::parse_table_update(raw_updates).map_err(|e| {
__sdk::InternalError::failed_parse("TableUpdate<BigFishAgentMessage>", "TableUpdate")
.with_cause(e)
.into()
__sdk::InternalError::failed_parse(
"TableUpdate<BigFishAgentMessage>",
"TableUpdate",
).with_cause(e).into()
})
}
#[allow(non_camel_case_types)]
/// Extension trait for query builder access to the table `BigFishAgentMessage`.
///
/// Implemented for [`__sdk::QueryTableAccessor`].
pub trait big_fish_agent_messageQueryTableAccess {
#[allow(non_snake_case)]
/// Get a query builder for the table `BigFishAgentMessage`.
fn big_fish_agent_message(&self) -> __sdk::__query_builder::Table<BigFishAgentMessage>;
}
#[allow(non_camel_case_types)]
/// Extension trait for query builder access to the table `BigFishAgentMessage`.
///
/// Implemented for [`__sdk::QueryTableAccessor`].
pub trait big_fish_agent_messageQueryTableAccess {
#[allow(non_snake_case)]
/// Get a query builder for the table `BigFishAgentMessage`.
fn big_fish_agent_message(&self) -> __sdk::__query_builder::Table<BigFishAgentMessage>;
}
impl big_fish_agent_messageQueryTableAccess for __sdk::QueryTableAccessor {
fn big_fish_agent_message(&self) -> __sdk::__query_builder::Table<BigFishAgentMessage> {
__sdk::__query_builder::Table::new("big_fish_agent_message")
}
}
impl big_fish_agent_messageQueryTableAccess for __sdk::QueryTableAccessor {
fn big_fish_agent_message(&self) -> __sdk::__query_builder::Table<BigFishAgentMessage> {
__sdk::__query_builder::Table::new("big_fish_agent_message")
}
}

View File

@@ -2,10 +2,15 @@
// WILL NOT BE SAVED. MODIFY TABLES IN YOUR MODULE SOURCE CODE INSTEAD.
#![allow(unused, clippy::all)]
use spacetimedb_sdk::__codegen::{self as __sdk, __lib, __sats, __ws};
use spacetimedb_sdk::__codegen::{
self as __sdk,
__lib,
__sats,
__ws,
};
use super::big_fish_agent_message_kind_type::BigFishAgentMessageKind;
use super::big_fish_agent_message_role_type::BigFishAgentMessageRole;
use super::big_fish_agent_message_kind_type::BigFishAgentMessageKind;
#[derive(__lib::ser::Serialize, __lib::de::Deserialize, Clone, PartialEq, Debug)]
#[sats(crate = __lib)]
@@ -18,10 +23,12 @@ pub struct BigFishAgentMessage {
pub created_at: __sdk::Timestamp,
}
impl __sdk::InModule for BigFishAgentMessage {
type Module = super::RemoteModule;
}
/// Column accessor struct for the table `BigFishAgentMessage`.
///
/// Provides typed access to columns for query building.
@@ -44,6 +51,7 @@ impl __sdk::__query_builder::HasCols for BigFishAgentMessage {
kind: __sdk::__query_builder::Col::new(table_name, "kind"),
text: __sdk::__query_builder::Col::new(table_name, "text"),
created_at: __sdk::__query_builder::Col::new(table_name, "created_at"),
}
}
}
@@ -62,8 +70,10 @@ impl __sdk::__query_builder::HasIxCols for BigFishAgentMessage {
BigFishAgentMessageIxCols {
message_id: __sdk::__query_builder::IxCol::new(table_name, "message_id"),
session_id: __sdk::__query_builder::IxCol::new(table_name, "session_id"),
}
}
}
impl __sdk::__query_builder::CanBeLookupTable for BigFishAgentMessage {}

View File

@@ -2,7 +2,12 @@
// WILL NOT BE SAVED. MODIFY TABLES IN YOUR MODULE SOURCE CODE INSTEAD.
#![allow(unused, clippy::all)]
use spacetimedb_sdk::__codegen::{self as __sdk, __lib, __sats, __ws};
use spacetimedb_sdk::__codegen::{
self as __sdk,
__lib,
__sats,
__ws,
};
use super::big_fish_anchor_status_type::BigFishAnchorStatus;
@@ -15,6 +20,8 @@ pub struct BigFishAnchorItem {
pub status: BigFishAnchorStatus,
}
impl __sdk::InModule for BigFishAnchorItem {
type Module = super::RemoteModule;
}

View File

@@ -2,7 +2,12 @@
// WILL NOT BE SAVED. MODIFY TABLES IN YOUR MODULE SOURCE CODE INSTEAD.
#![allow(unused, clippy::all)]
use spacetimedb_sdk::__codegen::{self as __sdk, __lib, __sats, __ws};
use spacetimedb_sdk::__codegen::{
self as __sdk,
__lib,
__sats,
__ws,
};
use super::big_fish_anchor_item_type::BigFishAnchorItem;
@@ -15,6 +20,8 @@ pub struct BigFishAnchorPack {
pub risk_tempo: BigFishAnchorItem,
}
impl __sdk::InModule for BigFishAnchorPack {
type Module = super::RemoteModule;
}

View File

@@ -2,7 +2,12 @@
// WILL NOT BE SAVED. MODIFY TABLES IN YOUR MODULE SOURCE CODE INSTEAD.
#![allow(unused, clippy::all)]
use spacetimedb_sdk::__codegen::{self as __sdk, __lib, __sats, __ws};
use spacetimedb_sdk::__codegen::{
self as __sdk,
__lib,
__sats,
__ws,
};
#[derive(__lib::ser::Serialize, __lib::de::Deserialize, Clone, PartialEq, Debug)]
#[sats(crate = __lib)]
@@ -15,8 +20,12 @@ pub enum BigFishAnchorStatus {
Missing,
Locked,
}
impl __sdk::InModule for BigFishAnchorStatus {
type Module = super::RemoteModule;
}

Some files were not shown because too many files have changed in this diff Show More