Skip to content

Commit

Permalink
game virtuals (#35)
Browse files Browse the repository at this point in the history
<!--
Thanks for sending a pull request!  Here are some tips for you:
  1. If the PR is unfinished, add '[WIP]' in your PR title, e.g., '[WIP][DIGIMON-XXXX] Your PR title ...'.
  2. Be sure to keep the PR description updated to reflect all changes.
  3. Please write your PR title to summarize what this PR proposes.
  4. If possible, provide a concise example to reproduce the issue for a faster review.
-->

### What changes were proposed in this pull request?
<!--
Please clarify what changes you are proposing. The purpose of this section is to outline the changes and how this PR fixes the issue. 
If possible, please consider writing useful notes for better and faster reviews in your PR. See the examples below.
  1. If you refactor some codes with changing classes, showing the class hierarchy will help reviewers.
  2. If you fix some SQL features, you can provide some references of other DBMSes.
  3. If there is design documentation, please add the link.
  4. If there is a discussion in the mailing list, please add the link.
-->


### Why are the changes needed?
<!--
Please clarify why the changes are needed. For instance,
  1. If you propose a new API, clarify the use case for a new API.
  2. If you fix a bug, you can clarify why it is a bug.
-->


### Does this PR introduce _any_ user-facing change?
<!--
Note that it means *any* user-facing change including all aspects such as the documentation fix.
If yes, please clarify the previous behavior and the change this PR proposes - provide the console output, description and/or an example to show the behavior difference if possible.
If possible, please also clarify if this is a user-facing change compared to the released Digimon Engine versions or within the unreleased branches such as master.
If no, write 'No'.
-->


### How was this patch tested?
<!--
If tests were added, say they were added here. Please make sure to add some test cases that check the changes thoroughly including negative and positive cases if possible.
If it was tested in a way different from regular unit tests, please clarify how you tested step by step, ideally copy and paste-able, so that other reviewers can test and check, and descendants can verify in the future.
If tests were not added, please describe why they were not added and/or why it was difficult to add.
-->
  • Loading branch information
JerryPan2718 authored Feb 2, 2025
1 parent 66547c9 commit 28d72ca
Show file tree
Hide file tree
Showing 7 changed files with 548 additions and 96 deletions.
158 changes: 158 additions & 0 deletions convex/_generated/api.d.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,158 @@
/* eslint-disable */
/**
* Generated `api` utility.
*
* THIS CODE IS AUTOMATICALLY GENERATED.
*
* To regenerate, run `npx convex dev`.
* @module
*/

import type {
ApiFromModules,
FilterApi,
FunctionReference,
} from "convex/server";
import type * as agent_cdpAgentkit from "../agent/cdpAgentkit.js";
import type * as agent_conversation from "../agent/conversation.js";
import type * as agent_embeddingsCache from "../agent/embeddingsCache.js";
import type * as agent_gameVirtual from "../agent/gameVirtual.js";
import type * as agent_memory from "../agent/memory.js";
import type * as agent_trade from "../agent/trade.js";
import type * as auth from "../auth.js";
import type * as constants from "../constants.js";
import type * as crons from "../crons.js";
import type * as damn_agent_agent from "../damn/agent/agent.js";
import type * as damn_agent_agentOperations from "../damn/agent/agentOperations.js";
import type * as damn_agent_inputs from "../damn/agent/inputs.js";
import type * as damn_conversation_conversation from "../damn/conversation/conversation.js";
import type * as damn_conversation_conversationMembership from "../damn/conversation/conversationMembership.js";
import type * as damn_conversation_inputs from "../damn/conversation/inputs.js";
import type * as damn_game from "../damn/game.js";
import type * as damn_gameConfig from "../damn/gameConfig.js";
import type * as damn_ids from "../damn/ids.js";
import type * as damn_inputHandler from "../damn/inputHandler.js";
import type * as damn_inputs from "../damn/inputs.js";
import type * as damn_insertInput from "../damn/insertInput.js";
import type * as damn_main from "../damn/main.js";
import type * as damn_player_inputs from "../damn/player/inputs.js";
import type * as damn_player_inventory from "../damn/player/inventory.js";
import type * as damn_player_location from "../damn/player/location.js";
import type * as damn_player_movement from "../damn/player/movement.js";
import type * as damn_player_player from "../damn/player/player.js";
import type * as damn_player_playerDescription from "../damn/player/playerDescription.js";
import type * as damn_trade_inputs from "../damn/trade/inputs.js";
import type * as damn_trade_trade from "../damn/trade/trade.js";
import type * as damn_trade_tradeDeal from "../damn/trade/tradeDeal.js";
import type * as damn_world from "../damn/world.js";
import type * as damn_worldMap from "../damn/worldMap.js";
import type * as engine_abstractGame from "../engine/abstractGame.js";
import type * as engine_historicalObject from "../engine/historicalObject.js";
import type * as http from "../http.js";
import type * as manageGame_api from "../manageGame/api.js";
import type * as manageGame_http from "../manageGame/http.js";
import type * as manageGame_service_clearGame from "../manageGame/service/clearGame.js";
import type * as manageGame_service_createGame from "../manageGame/service/createGame.js";
import type * as manageGame_service_pauseGame from "../manageGame/service/pauseGame.js";
import type * as manageGame_service_resumeGame from "../manageGame/service/resumeGame.js";
import type * as manageGame_service_updateGame from "../manageGame/service/updateGame.js";
import type * as manageGame_test from "../manageGame/test.js";
import type * as manageGame_types from "../manageGame/types.js";
import type * as map from "../map.js";
import type * as messages from "../messages.js";
import type * as testing from "../testing.js";
import type * as user_user from "../user/user.js";
import type * as util_FastIntegerCompression from "../util/FastIntegerCompression.js";
import type * as util_assertNever from "../util/assertNever.js";
import type * as util_asyncMap from "../util/asyncMap.js";
import type * as util_compression from "../util/compression.js";
import type * as util_geometry from "../util/geometry.js";
import type * as util_isSimpleObject from "../util/isSimpleObject.js";
import type * as util_llm from "../util/llm.js";
import type * as util_minheap from "../util/minheap.js";
import type * as util_object from "../util/object.js";
import type * as util_sleep from "../util/sleep.js";
import type * as util_types from "../util/types.js";
import type * as util_xxhash from "../util/xxhash.js";
import type * as world from "../world.js";

/**
* A utility for referencing Convex functions in your app's API.
*
* Usage:
* ```js
* const myFunctionReference = api.myModule.myFunction;
* ```
*/
declare const fullApi: ApiFromModules<{
"agent/cdpAgentkit": typeof agent_cdpAgentkit;
"agent/conversation": typeof agent_conversation;
"agent/embeddingsCache": typeof agent_embeddingsCache;
"agent/gameVirtual": typeof agent_gameVirtual;
"agent/memory": typeof agent_memory;
"agent/trade": typeof agent_trade;
auth: typeof auth;
constants: typeof constants;
crons: typeof crons;
"damn/agent/agent": typeof damn_agent_agent;
"damn/agent/agentOperations": typeof damn_agent_agentOperations;
"damn/agent/inputs": typeof damn_agent_inputs;
"damn/conversation/conversation": typeof damn_conversation_conversation;
"damn/conversation/conversationMembership": typeof damn_conversation_conversationMembership;
"damn/conversation/inputs": typeof damn_conversation_inputs;
"damn/game": typeof damn_game;
"damn/gameConfig": typeof damn_gameConfig;
"damn/ids": typeof damn_ids;
"damn/inputHandler": typeof damn_inputHandler;
"damn/inputs": typeof damn_inputs;
"damn/insertInput": typeof damn_insertInput;
"damn/main": typeof damn_main;
"damn/player/inputs": typeof damn_player_inputs;
"damn/player/inventory": typeof damn_player_inventory;
"damn/player/location": typeof damn_player_location;
"damn/player/movement": typeof damn_player_movement;
"damn/player/player": typeof damn_player_player;
"damn/player/playerDescription": typeof damn_player_playerDescription;
"damn/trade/inputs": typeof damn_trade_inputs;
"damn/trade/trade": typeof damn_trade_trade;
"damn/trade/tradeDeal": typeof damn_trade_tradeDeal;
"damn/world": typeof damn_world;
"damn/worldMap": typeof damn_worldMap;
"engine/abstractGame": typeof engine_abstractGame;
"engine/historicalObject": typeof engine_historicalObject;
http: typeof http;
"manageGame/api": typeof manageGame_api;
"manageGame/http": typeof manageGame_http;
"manageGame/service/clearGame": typeof manageGame_service_clearGame;
"manageGame/service/createGame": typeof manageGame_service_createGame;
"manageGame/service/pauseGame": typeof manageGame_service_pauseGame;
"manageGame/service/resumeGame": typeof manageGame_service_resumeGame;
"manageGame/service/updateGame": typeof manageGame_service_updateGame;
"manageGame/test": typeof manageGame_test;
"manageGame/types": typeof manageGame_types;
map: typeof map;
messages: typeof messages;
testing: typeof testing;
"user/user": typeof user_user;
"util/FastIntegerCompression": typeof util_FastIntegerCompression;
"util/assertNever": typeof util_assertNever;
"util/asyncMap": typeof util_asyncMap;
"util/compression": typeof util_compression;
"util/geometry": typeof util_geometry;
"util/isSimpleObject": typeof util_isSimpleObject;
"util/llm": typeof util_llm;
"util/minheap": typeof util_minheap;
"util/object": typeof util_object;
"util/sleep": typeof util_sleep;
"util/types": typeof util_types;
"util/xxhash": typeof util_xxhash;
world: typeof world;
}>;
export declare const api: FilterApi<
typeof fullApi,
FunctionReference<any, "public">
>;
export declare const internal: FilterApi<
typeof fullApi,
FunctionReference<any, "internal">
>;
22 changes: 22 additions & 0 deletions convex/_generated/api.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
/* eslint-disable */
/**
* Generated `api` utility.
*
* THIS CODE IS AUTOMATICALLY GENERATED.
*
* To regenerate, run `npx convex dev`.
* @module
*/

import { anyApi } from "convex/server";

/**
* A utility for referencing Convex functions in your app's API.
*
* Usage:
* ```js
* const myFunctionReference = api.myModule.myFunction;
* ```
*/
export const api = anyApi;
export const internal = anyApi;
60 changes: 60 additions & 0 deletions convex/_generated/dataModel.d.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,60 @@
/* eslint-disable */
/**
* Generated data model types.
*
* THIS CODE IS AUTOMATICALLY GENERATED.
*
* To regenerate, run `npx convex dev`.
* @module
*/

import type {
DataModelFromSchemaDefinition,
DocumentByName,
TableNamesInDataModel,
SystemTableNames,
} from "convex/server";
import type { GenericId } from "convex/values";
import schema from "../schema.js";

/**
* The names of all of your Convex tables.
*/
export type TableNames = TableNamesInDataModel<DataModel>;

/**
* The type of a document stored in Convex.
*
* @typeParam TableName - A string literal type of the table name (like "users").
*/
export type Doc<TableName extends TableNames> = DocumentByName<
DataModel,
TableName
>;

/**
* An identifier for a document in Convex.
*
* Convex documents are uniquely identified by their `Id`, which is accessible
* on the `_id` field. To learn more, see [Document IDs](https://docs.convex.dev/using/document-ids).
*
* Documents can be loaded using `db.get(id)` in query and mutation functions.
*
* IDs are just strings at runtime, but this type can be used to distinguish them from other
* strings when type checking.
*
* @typeParam TableName - A string literal type of the table name (like "users").
*/
export type Id<TableName extends TableNames | SystemTableNames> =
GenericId<TableName>;

/**
* A type describing your Convex data model.
*
* This type includes information about what tables you have, the type of
* documents stored in those tables, and the indexes defined on them.
*
* This type is used to parameterize methods like `queryGeneric` and
* `mutationGeneric` to make them type-safe.
*/
export type DataModel = DataModelFromSchemaDefinition<typeof schema>;
142 changes: 142 additions & 0 deletions convex/_generated/server.d.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,142 @@
/* eslint-disable */
/**
* Generated utilities for implementing server-side Convex query and mutation functions.
*
* THIS CODE IS AUTOMATICALLY GENERATED.
*
* To regenerate, run `npx convex dev`.
* @module
*/

import {
ActionBuilder,
HttpActionBuilder,
MutationBuilder,
QueryBuilder,
GenericActionCtx,
GenericMutationCtx,
GenericQueryCtx,
GenericDatabaseReader,
GenericDatabaseWriter,
} from "convex/server";
import type { DataModel } from "./dataModel.js";

/**
* Define a query in this Convex app's public API.
*
* This function will be allowed to read your Convex database and will be accessible from the client.
*
* @param func - The query function. It receives a {@link QueryCtx} as its first argument.
* @returns The wrapped query. Include this as an `export` to name it and make it accessible.
*/
export declare const query: QueryBuilder<DataModel, "public">;

/**
* Define a query that is only accessible from other Convex functions (but not from the client).
*
* This function will be allowed to read from your Convex database. It will not be accessible from the client.
*
* @param func - The query function. It receives a {@link QueryCtx} as its first argument.
* @returns The wrapped query. Include this as an `export` to name it and make it accessible.
*/
export declare const internalQuery: QueryBuilder<DataModel, "internal">;

/**
* Define a mutation in this Convex app's public API.
*
* This function will be allowed to modify your Convex database and will be accessible from the client.
*
* @param func - The mutation function. It receives a {@link MutationCtx} as its first argument.
* @returns The wrapped mutation. Include this as an `export` to name it and make it accessible.
*/
export declare const mutation: MutationBuilder<DataModel, "public">;

/**
* Define a mutation that is only accessible from other Convex functions (but not from the client).
*
* This function will be allowed to modify your Convex database. It will not be accessible from the client.
*
* @param func - The mutation function. It receives a {@link MutationCtx} as its first argument.
* @returns The wrapped mutation. Include this as an `export` to name it and make it accessible.
*/
export declare const internalMutation: MutationBuilder<DataModel, "internal">;

/**
* Define an action in this Convex app's public API.
*
* An action is a function which can execute any JavaScript code, including non-deterministic
* code and code with side-effects, like calling third-party services.
* They can be run in Convex's JavaScript environment or in Node.js using the "use node" directive.
* They can interact with the database indirectly by calling queries and mutations using the {@link ActionCtx}.
*
* @param func - The action. It receives an {@link ActionCtx} as its first argument.
* @returns The wrapped action. Include this as an `export` to name it and make it accessible.
*/
export declare const action: ActionBuilder<DataModel, "public">;

/**
* Define an action that is only accessible from other Convex functions (but not from the client).
*
* @param func - The function. It receives an {@link ActionCtx} as its first argument.
* @returns The wrapped function. Include this as an `export` to name it and make it accessible.
*/
export declare const internalAction: ActionBuilder<DataModel, "internal">;

/**
* Define an HTTP action.
*
* This function will be used to respond to HTTP requests received by a Convex
* deployment if the requests matches the path and method where this action
* is routed. Be sure to route your action in `convex/http.js`.
*
* @param func - The function. It receives an {@link ActionCtx} as its first argument.
* @returns The wrapped function. Import this function from `convex/http.js` and route it to hook it up.
*/
export declare const httpAction: HttpActionBuilder;

/**
* A set of services for use within Convex query functions.
*
* The query context is passed as the first argument to any Convex query
* function run on the server.
*
* This differs from the {@link MutationCtx} because all of the services are
* read-only.
*/
export type QueryCtx = GenericQueryCtx<DataModel>;

/**
* A set of services for use within Convex mutation functions.
*
* The mutation context is passed as the first argument to any Convex mutation
* function run on the server.
*/
export type MutationCtx = GenericMutationCtx<DataModel>;

/**
* A set of services for use within Convex action functions.
*
* The action context is passed as the first argument to any Convex action
* function run on the server.
*/
export type ActionCtx = GenericActionCtx<DataModel>;

/**
* An interface to read from the database within Convex query functions.
*
* The two entry points are {@link DatabaseReader.get}, which fetches a single
* document by its {@link Id}, or {@link DatabaseReader.query}, which starts
* building a query.
*/
export type DatabaseReader = GenericDatabaseReader<DataModel>;

/**
* An interface to read from and write to the database within Convex mutation
* functions.
*
* Convex guarantees that all writes within a single mutation are
* executed atomically, so you never have to worry about partial writes leaving
* your data in an inconsistent state. See [the Convex Guide](https://docs.convex.dev/understanding/convex-fundamentals/functions#atomicity-and-optimistic-concurrency-control)
* for the guarantees Convex provides your functions.
*/
export type DatabaseWriter = GenericDatabaseWriter<DataModel>;
Loading

0 comments on commit 28d72ca

Please sign in to comment.