narraeon 0.1.1-oidc.1 → 0.2.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (28) hide show
  1. package/README.md +4 -1
  2. package/README.zh-CN.md +2 -2
  3. package/dist/node/protocol/modelConnections.js +49 -0
  4. package/dist/node/protocol/modelUsage.js +39 -0
  5. package/dist/node/protocol/v1.js +29 -0
  6. package/dist/node/runtime/V1Runtime.js +59 -23
  7. package/dist/node/runtime/model/FileNativeModelAdapters.js +691 -275
  8. package/dist/node/runtime/model/ModelConnectionStore.js +123 -2
  9. package/dist/node/runtime/model/ModelHost.js +74 -9
  10. package/dist/node/runtime/model/ModelHostStream.js +61 -1
  11. package/dist/node/runtime/model/SettingAuthorStream.js +16 -113
  12. package/dist/node/runtime/play/FileNativePlayAdvanceStore.js +269 -0
  13. package/dist/node/runtime/play/FileNativePlayTimelineStore.js +1039 -0
  14. package/dist/node/runtime/play/PlayCallChain.js +609 -330
  15. package/dist/node/runtime/play/PlayDocumentTools.js +35 -0
  16. package/dist/node/runtime/play/PlayFollowupRequests.js +1 -4
  17. package/dist/node/runtime/prompt/FileNativePromptCompiler.js +45 -30
  18. package/dist/node/runtime/prompt/FileNativeToolRegistry.js +55 -29
  19. package/dist/node/runtime/setting/DocumentCandidateSettingImprovement.js +9 -4
  20. package/dist/node/runtime/world/FileNativeWorldStorageMigrator.js +626 -0
  21. package/dist/node/runtime/world/FileNativeWorldStore.js +449 -191
  22. package/dist/node/server/createServer.js +0 -27
  23. package/dist/web/assets/index-DHV_VWl3.js +1192 -0
  24. package/dist/web/assets/index-DjLCkP99.css +1 -0
  25. package/dist/web/index.html +2 -2
  26. package/package.json +1 -1
  27. package/dist/web/assets/index-CRGTZ9Ak.css +0 -1
  28. package/dist/web/assets/index-DDx1itzT.js +0 -1192
@@ -58,24 +58,7 @@ export async function createServer(input) {
58
58
  : { stream: input.logStream }),
59
59
  },
60
60
  });
61
- const suffix = input.port === 80 ? "" : `:${input.port}`;
62
- const origins = new Set([
63
- `http://127.0.0.1${suffix}`,
64
- `http://localhost${suffix}`,
65
- ]);
66
61
  const html = await readFile(join(input.staticRoot, "index.html"), "utf8");
67
- // Origin is what actually stops a hostile page from driving this server: a
68
- // cross-site request carries its own origin, and a JSON POST always triggers
69
- // a preflight, so the header is always there to check. A per-boot token on
70
- // top bought nothing against that threat and made every restart invalidate
71
- // the tab the user already had open.
72
- const sameOrigin = (request, reply, done) => {
73
- if (request.headers.origin === undefined ||
74
- !origins.has(request.headers.origin))
75
- void forbidden(reply);
76
- else
77
- done();
78
- };
79
62
  const logRuntimeRequest = (request, _reply, done) => {
80
63
  if (!isPollingRequest(request))
81
64
  request.log.info({ req: request }, "incoming request");
@@ -100,7 +83,6 @@ export async function createServer(input) {
100
83
  }));
101
84
  server.post("/api/runtime/v1", {
102
85
  bodyLimit: runtimeRequestBodyLimit,
103
- onRequest: [sameOrigin],
104
86
  preHandler: [logRuntimeRequest],
105
87
  }, async (request, reply) => {
106
88
  let runtimeRequestType;
@@ -207,12 +189,3 @@ function isPlayCallChainView(value) {
207
189
  value.status === "running" ||
208
190
  value.status === "interrupted"));
209
191
  }
210
- function forbidden(reply) {
211
- return reply.status(403).send({
212
- protocol: "narraeon.runtime/v1",
213
- error: {
214
- code: "forbidden_request",
215
- message: "Local web request is not authorized",
216
- },
217
- });
218
- }