Skip to content

Commit

Permalink
Merge pull request #395 from permaweb/twilson63/fix-add-inbox-msg-boo…
Browse files Browse the repository at this point in the history
…tloader

Twilson63/fix add inbox msg bootloader
  • Loading branch information
twilson63 authored Nov 6, 2024
2 parents 2b3e45a + 08cedec commit d12b436
Show file tree
Hide file tree
Showing 6 changed files with 35 additions and 21 deletions.
4 changes: 2 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -6,9 +6,9 @@


Version: 2.0.1
Module: `oKBlsMP3UWrAUURWUzGO4ZGEqlurAL5UkidMLrYo8EM`
Module: `Do_Uc2Sju_ffp6Ev0AnLVdPtot15rvMjP-a9VVaA5fM`

Sqlite-Module: `9VBLtu07DtUhPNdIqnw0Z_QJ_GKQqNXHpzumG8DY-J4`
Sqlite-Module: `GuzQrkf50rBUqz3uUgjOIFOL1XmW9nSNysTBC-wyiWM`

## Requirements

Expand Down
4 changes: 2 additions & 2 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -31,8 +31,8 @@
"yargs": "^17.7.2"
},
"aos": {
"module": "oKBlsMP3UWrAUURWUzGO4ZGEqlurAL5UkidMLrYo8EM",
"sqlite": "9VBLtu07DtUhPNdIqnw0Z_QJ_GKQqNXHpzumG8DY-J4",
"module": "Do_Uc2Sju_ffp6Ev0AnLVdPtot15rvMjP-a9VVaA5fM",
"sqlite": "GuzQrkf50rBUqz3uUgjOIFOL1XmW9nSNysTBC-wyiWM",
"llama": "7eiZkMWDUQmY1SBIpumzYR5_XhVMbnjmA27Xbyt4QxU",
"version": "2.0.1"
},
Expand Down
3 changes: 3 additions & 0 deletions process/boot.lua
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,9 @@ end
return function (ao)
local eval = require(".eval")(ao)
return function (msg)
if #Inbox == 0 then
table.insert(Inbox, msg)
end
if msg.Tags['On-Boot'] == nil then
return
end
Expand Down
1 change: 1 addition & 0 deletions process/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@
"build": "ao build",
"test": "node --test --experimental-wasm-memory64",
"deploy": "ao publish -w ~/.wallet.json process.wasm -t Memory-Limit -v 1-gb -t Compute-Limit -v 9000000000000 -t Module-Format -v wasm64-unknown-emscripten-draft_2024_02_15 -t AOS-Version -v 2.0.1 -t Name -v aos-lg-2.0.1",
"deploy-test": "ao publish -w ~/.wallet.json process.wasm -t Memory-Limit -v 1-gb -t Compute-Limit -v 9000000000000 -t Module-Format -v wasm64-unknown-emscripten-draft_2024_02_15 -t AOS-Version -v 2.0.1 -t Name -v aos-test",
"deploy-sqlite": "ao publish -w ~/.wallet.json process.wasm -t Memory-Limit -v 1-gb -t Compute-Limit -v 9000000000000 -t Module-Format -v wasm64-unknown-emscripten-draft_2024_02_15 -t AOS-Version -v 2.0.1 -t Name -v sqlite-lg-2.0.1",
"deploy-llama": "ao publish -w ~/.wallet.json process.wasm -t Memory-Limit -v 16-gb -t Compute-Limit -v 9000000000000 -t Module-Format -v wasm64-unknown-emscripten-draft_2024_02_15 -t AOS-Version -v 2.0.1 -t Name -v llama-xxl-2.0.1 -t Extension -v WeaveDrive"
}
Expand Down
42 changes: 26 additions & 16 deletions process/process.lua
Original file line number Diff line number Diff line change
Expand Up @@ -363,7 +363,7 @@ function process.handle(msg, _)
-- See: https://github.com/permaweb/aos/issues/342
Handlers.once("_boot",
function (msg)
return msg.Tags.Type == "Process" and Owner == msg.From
return msg.Tags.Type == "Process" and Owner == msg.From
end,
require('.boot')(ao)
)
Expand Down Expand Up @@ -449,24 +449,34 @@ function process.handle(msg, _)
HANDLER_PRINT_LOGS = {} -- clear logs
return response
elseif msg.Tags.Type == "Process" and Owner == msg.From then
local response = nil
local response = ao.result({
Output = {
data = table.concat(HANDLER_PRINT_LOGS, "\n"),
prompt = Prompt(),
print = true
}
})
HANDLER_PRINT_LOGS = {} -- clear logs
return response

-- local response = nil

-- detect if there was any output from the boot loader call
for _, value in pairs(HANDLER_PRINT_LOGS) do
if value ~= "" then
-- there was output from the Boot Loader eval so we want to print it
response = ao.result({ Output = { data = table.concat(HANDLER_PRINT_LOGS, "\n"), prompt = Prompt(), print = true } })
break
end
end
-- -- detect if there was any output from the boot loader call
-- for _, value in pairs(HANDLER_PRINT_LOGS) do
-- if value ~= "" then
-- -- there was output from the Boot Loader eval so we want to print it
-- response = ao.result({ Output = { data = table.concat(HANDLER_PRINT_LOGS, "\n"), prompt = Prompt(), print = true } })
-- break
-- end
-- end

if response == nil then
-- there was no output from the Boot Loader eval, so we shouldn't print it
response = ao.result({ Output = { data = "", prompt = Prompt() } })
end
-- if response == nil then
-- -- there was no output from the Boot Loader eval, so we shouldn't print it
-- response = ao.result({ Output = { data = "", prompt = Prompt() } })
-- end

HANDLER_PRINT_LOGS = {} -- clear logs
return response
-- HANDLER_PRINT_LOGS = {} -- clear logs
-- return response
else
local response = ao.result({ Output = { data = table.concat(HANDLER_PRINT_LOGS, "\n"), prompt = Prompt(), print = true } })
HANDLER_PRINT_LOGS = {} -- clear logs
Expand Down
2 changes: 1 addition & 1 deletion src/services/connect.js
Original file line number Diff line number Diff line change
Expand Up @@ -160,7 +160,7 @@ export async function live(id, watch) {
if (cursor) {
params["from"] = cursor
} else {
params["limit"] = 1
params["limit"] = 5
params["sort"] = "DESC"
}

Expand Down

0 comments on commit d12b436

Please sign in to comment.