create-wirejs-app 2.0.171 → 2.0.173

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "create-wirejs-app",
3
- "version": "2.0.171",
3
+ "version": "2.0.173",
4
4
  "description": "Initializes a wirejs package.",
5
5
  "author": "Jon Wire",
6
6
  "license": "MIT",
@@ -1,4 +1,4 @@
1
- import type { ToolCall } from 'wirejs-resources';
1
+ import type { ToolCall, ToolMessage } from 'wirejs-resources';
2
2
  import { Infra } from './infra.js'
3
3
  import { cleanTitle } from './utils.js';
4
4
  import { generateConversationTitle } from './prompts.js';
@@ -58,6 +58,7 @@ export const tooledHandler = (infra: Infra) => async (
58
58
  history.push(response);
59
59
 
60
60
  toolCalls = tools && tools.length > 0 ? response.tool_calls ?? [] : [];
61
+ const toolMessage: ToolMessage = { role: 'tool', content: [] };
61
62
  for (const call of toolCalls) {
62
63
  const name = call.function.name;
63
64
  const args = call.function.arguments;
@@ -82,22 +83,24 @@ export const tooledHandler = (infra: Infra) => async (
82
83
 
83
84
  // makes tool results visible in the conversation history
84
85
  // to the agent.
85
- history.push(await infra.addMessage(room, mid++, {
86
- role: 'tool',
87
- tool_name: name,
88
- tool_call_id: call.id || JSON.stringify([name, args]),
86
+ toolMessage.content.push({
87
+ id: call.id || JSON.stringify([name, args]),
89
88
  content: JSON.stringify(r, null, 2),
90
- }));
89
+ isError: false,
90
+ })
91
91
  } catch (error) {
92
- history.push(await infra.addMessage(room, mid++, {
93
- role: 'tool',
94
- tool_name: name,
95
- tool_call_id: call.id || JSON.stringify([name, args]),
92
+ toolMessage.content.push({
93
+ id: call.id || JSON.stringify([name, args]),
96
94
  content: String(error),
97
- }))
95
+ isError: true,
96
+ })
98
97
  }
99
98
  }
100
99
 
100
+ if (toolCalls.length > 0) {
101
+ history.push(await infra.addMessage(room, mid++, toolMessage));
102
+ }
103
+
101
104
  maxLoops--;
102
105
  } while (toolCalls.length > 0);
103
106
 
@@ -1,4 +1,4 @@
1
- import { AuthenticationService, Endpoint } from 'wirejs-resources';
1
+ import { AuthenticationService, Endpoint, GoogleOIDCProvider } from 'wirejs-resources';
2
2
  import { Chat } from './apps/chat.js';
3
3
  import { Todos } from './apps/todos.js';
4
4
  import { Wiki } from './apps/wiki.js';
@@ -11,7 +11,9 @@ export type * from './apps/todos.js';
11
11
  export type * from './apps/store.js';
12
12
  export type * from './apps/admin.js';
13
13
 
14
- const authService = new AuthenticationService('app', 'core-users');
14
+ const authService = new AuthenticationService('app', 'core-users', {
15
+ oidcProviders: [ GoogleOIDCProvider ]
16
+ });
15
17
 
16
18
  export const auth = authService.buildApi();
17
19
  export const chat = Chat(auth);
@@ -11,15 +11,15 @@
11
11
  "dependencies": {
12
12
  "dompurify": "^3.2.3",
13
13
  "marked": "^15.0.6",
14
+ "wirejs-components": "^0.1.111",
14
15
  "wirejs-dom": "^1.0.44",
15
- "wirejs-resources": "^0.1.166",
16
- "wirejs-components": "^0.1.109",
17
- "wirejs-module-payments-stripe": "^0.1.60",
18
- "wirejs-web-worker": "^1.0.63"
16
+ "wirejs-module-payments-stripe": "^0.1.62",
17
+ "wirejs-resources": "^0.1.168",
18
+ "wirejs-web-worker": "^1.0.65"
19
19
  },
20
20
  "devDependencies": {
21
- "wirejs-scripts": "^3.0.164",
22
- "typescript": "^5.7.3"
21
+ "typescript": "^5.7.3",
22
+ "wirejs-scripts": "^3.0.166"
23
23
  },
24
24
  "scripts": {
25
25
  "prebuild": "npm run prebuild --workspaces --if-present",
@@ -12,7 +12,7 @@ const DISCLAIMER = html`<div>
12
12
 
13
13
  async function Account() {
14
14
  return html`<div id='${MENU_ID}'>
15
- ${AccountMenu({ api: auth })}
15
+ ${await AccountMenu({ api: auth })}
16
16
  </div>`;
17
17
  }
18
18
 
@@ -1,4 +1,5 @@
1
1
  import { html, list, node, text, hydrate } from 'wirejs-dom/v2';
2
+ import { AuthenticatedContent } from 'wirejs-components';
2
3
  import { Main } from '../layouts/main.js';
3
4
  import { admin, Endpoint, Setting, SystemAttribute } from 'internal-api';
4
5
 
@@ -154,14 +155,15 @@ function Admin() {
154
155
 
155
156
  async function App() {
156
157
  const self = html`<div id='app'>
157
- ${node('isAdmin', false, (isAdmin: boolean | undefined) =>
158
- isAdmin ?
159
- html`<div><p>Your <b>are</b> an admin.</p>${Admin()}</div>`
160
- : html`<p>You are <b>NOT</b> an admin.</p>`
161
- )}
162
- </div>`.onadd(async self => {
163
- self.data.isAdmin = await admin.isAdmin(null);
164
- });
158
+ ${await AuthenticatedContent({
159
+ authenticated: async () => {
160
+ return (await admin.isAdmin(null)) ?
161
+ html`<div><p>Your <b>are</b> an admin.</p>${Admin()}</div>`
162
+ : html`<p>You are <b>NOT</b> an admin.</p>`
163
+ },
164
+ unauthenticated: () => html`<p>You are not signed in.</p>`,
165
+ })}
166
+ </div>`;
165
167
  return self;
166
168
  }
167
169